Exception with `%config SqlMagic.autopandas=True`
See original GitHub issue%config SqlMagic.autopandas=True
%%sql
SELECT 1 AS one
Done.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-19-5d9ee192c327> in <module>()
----> 1 get_ipython().run_cell_magic('sql', '', 'SELECT 1 AS one')
/home/miki/playground/nbext/cenv/lib/python3.5/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
2113 magic_arg_s = self.var_expand(line, stack_depth)
2114 with self.builtin_trap:
-> 2115 result = fn(magic_arg_s, cell)
2116 return result
2117
<decorator-gen-123> in execute(self, line, cell, local_ns)
/home/miki/playground/nbext/cenv/lib/python3.5/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
186 # but it's overkill for just that one bit of state.
187 def magic_deco(arg):
--> 188 call = lambda f, *a, **k: f(*a, **k)
189
190 if callable(arg):
<decorator-gen-122> in execute(self, line, cell, local_ns)
/home/miki/playground/nbext/cenv/lib/python3.5/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
186 # but it's overkill for just that one bit of state.
187 def magic_deco(arg):
--> 188 call = lambda f, *a, **k: f(*a, **k)
189
190 if callable(arg):
/home/miki/playground/nbext/cenv/lib/python3.5/site-packages/sql/magic.py in execute(self, line, cell, local_ns)
87 result = sql.run.run(conn, parsed['sql'], self, user_ns)
88
---> 89 if result and ~isinstance(result, str) and self.column_local_vars:
90 #Instead of returning values, set variables directly in the
91 #users namespace. Variable names given by column names
/home/miki/playground/nbext/cenv/lib/python3.5/site-packages/pandas/core/generic.py in __nonzero__(self)
915 raise ValueError("The truth value of a {0} is ambiguous. "
916 "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
--> 917 .format(self.__class__.__name__))
918
919 __bool__ = __nonzero__
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
Jupyter notebook: disable autocommit when using the %sql ...
Addendum, when I use the %config SqlMagic.autocommit=False option, I have: UserWarning: Config option autocommit not recognized by SqlMagic .
Read more >Jupyter Magics with SQL - Towards Data Science
Let's explore Jupyter SQL magic that allows us to interact with Presto or ... %config SqlMagic.autocommit=False # for engines that do not ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in commit b52e09a.
As of now, PyPI doesn’t have this fix, but you can install the latest (and fixed) version with:
or
or
(edited after https://github.com/catherinedevlin/ipython-sql/issues/67#issuecomment-298316969)
I do not believe that this is fixed. The attached notebook is a very simple case - basis SQL works. However, with autopandas=True, you get error. SQL Magic Test Py3.ipynb.zip