Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL notebook has issues in 64 bit invornment. #2

Open
jantonisito opened this issue Dec 14, 2016 · 2 comments
Open

SQL notebook has issues in 64 bit invornment. #2

jantonisito opened this issue Dec 14, 2016 · 2 comments

Comments

@jantonisito
Copy link

I tried 32 bit Anaconda first and it worked OK until I tried creating jupyter_r environment then test R notebook. But SQL notebook worked. So I switched to 64 bit Anaconda (installing it from Miniconda) and now SQL notebook is broken:
%%sql sqlite://
CREATE TABLE presidents (first_name, last_name, year_of_birth);
INSERT INTO presidents VALUES ('George', 'Washington', 1732);
INSERT INTO presidents VALUES ('John', 'Adams', 1735);
INSERT INTO presidents VALUES ('Thomas', 'Jefferson', 1743);
INSERT INTO presidents VALUES ('James', 'Madison', 1751);
INSERT INTO presidents VALUES ('James', 'Monroe', 1758);
INSERT INTO presidents VALUES ('Zachary', 'Taylor', 1784);
INSERT INTO presidents VALUES ('Abraham', 'Lincoln', 1809);
INSERT INTO presidents VALUES ('Theodore', 'Roosevelt', 1858);
INSERT INTO presidents VALUES ('Richard', 'Nixon', 1913);
INSERT INTO presidents VALUES ('Barack', 'Obama', 1961);
gives:
Done.
1 rows affected.
1 rows affected.
1 rows affected.
1 rows affected.
1 rows affected.
1 rows affected.
1 rows affected.
1 rows affected.
1 rows affected.
1 rows affected.


ValueError Traceback (most recent call last)
in ()
----> 1 get_ipython().run_cell_magic(u'sql', u'sqlite://', u"CREATE TABLE presidents (first_name, last_name, year_of_birth);\nINSERT INTO presidents VALUES ('George', 'Washington', 1732);\nINSERT INTO presidents VALUES ('John', 'Adams', 1735);\nINSERT INTO presidents VALUES ('Thomas', 'Jefferson', 1743);\nINSERT INTO presidents VALUES ('James', 'Madison', 1751);\nINSERT INTO presidents VALUES ('James', 'Monroe', 1758);\nINSERT INTO presidents VALUES ('Zachary', 'Taylor', 1784);\nINSERT INTO presidents VALUES ('Abraham', 'Lincoln', 1809);\nINSERT INTO presidents VALUES ('Theodore', 'Roosevelt', 1858);\nINSERT INTO presidents VALUES ('Richard', 'Nixon', 1913);\nINSERT INTO presidents VALUES ('Barack', 'Obama', 1961);")

C:\Users\IBM_ADMIN\Miniconda2\lib\site-packages\IPython\core\interactiveshell.pyc 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

in execute(self, line, cell, local_ns)

C:\Users\IBM_ADMIN\Miniconda2\lib\site-packages\IPython\core\magic.pyc in (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):

in execute(self, line, cell, local_ns)

C:\Users\IBM_ADMIN\Miniconda2\lib\site-packages\IPython\core\magic.pyc in (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):

C:\Users\IBM_ADMIN\Miniconda2\lib\site-packages\sql\magic.pyc 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

C:\Users\IBM_ADMIN\Miniconda2\lib\site-packages\pandas\core\generic.pyc in nonzero(self)
890 raise ValueError("The truth value of a {0} is ambiguous. "
891 "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
--> 892 .format(self.class.name))
893
894 bool = nonzero

ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

And similar for the rest of the notebook:
NameError: name 'later_presidents' is not defined>

For the reference I installed ipython-sql as suggested:
c:\econfig\UserData\Safari\jupyter-data-science-teams>conda search ipython-sql
Fetching package metadata .........

c:\econfig\UserData\Safari\jupyter-data-science-teams>pip install ipython-sql
Collecting ipython-sql
Downloading ipython-sql-0.3.8.tar.gz
Collecting prettytable (from ipython-sql)
Downloading prettytable-0.7.2.zip
Requirement already satisfied (use --upgrade to upgrade): ipython>=1.0 in c:\users\ibm_admin\miniconda2\lib\site-packages (from ipython-sql)
Requirement already satisfied (use --upgrade to upgrade): sqlalchemy>=0.6.7 in c:\users\ibm_admin\miniconda2\lib\site-packages (from ipython-sql)
Collecting sqlparse (from ipython-sql)
Downloading sqlparse-0.2.2-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six in c:\users\ibm_admin\miniconda2\lib\site-packages (from ipython-sql)
Requirement already satisfied (use --upgrade to upgrade): ipython-genutils>=0.1.0 in c:\users\ibm_admin\miniconda2\lib\site-packages (from ipython-sql)
Building wheels for collected packages: ipython-sql, prettytable
Running setup.py bdist_wheel for ipython-sql ... done
Stored in directory: C:\Users\IBM_ADMIN\AppData\Local\pip\Cache\wheels\98\e3\5f\78dcb15c0532616bb007d42a6086d9b499c3b4728b29596936
Running setup.py bdist_wheel for prettytable ... done
Stored in directory: C:\Users\IBM_ADMIN\AppData\Local\pip\Cache\wheels\b6\90\7b\1c22b89217d0eba6d5f406e562365ebee804f0d4595b2bdbcd
Successfully built ipython-sql prettytable
Installing collected packages: prettytable, sqlparse, ipython-sql
Successfully installed ipython-sql-0.3.8 prettytable-0.7.2 sqlparse-0.2.2
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

@jbwhit
Copy link
Owner

jbwhit commented Dec 15, 2016

This is a more confusing bug, but this falls squarely into the https://github.com/catherinedevlin/ipython-sql extension -- can you open an issue there? Feel free to leave this issue here and link back.

@jantonisito
Copy link
Author

jantonisito commented Dec 15, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants