Hi. I’m really struggling to connect the database to Jupyter in my SQL guided projects (first the CIA Factbook porject and now Answering Business questions using SQL.
I’m sorry to ask this question as I know that it has been asked multiple times, but I have read through many of the threads about this and still not found a solution.
I have installed ipython-sql, but when I run
%%capture
%load_ext sql
%sql sqlite:///chinook.db
I get no output.
I have also tried to add this at the top of my notebook (as suggested in another thread) and it says that the commands do not exist:
I’m at a loss for what else I can try - does anyone by any chance have some other ideas? It works on the DQ Jupyter notebook, just not my local notebook.
What is the output you are expecting here? because even I don’t get any output after executing this command.
Try this code in the next cell and let us know if this gives you an error.
%%sql
SELECT *
FROM sqlite_master
WHERE type='table';
And if it gives you a dataframe like structure and this message, you are good to go:
* sqlite:///<database_name>.db
Done.
Please do mention the OS in case you still get an error. As I use Windows and have no experience with Mac, so will have to highlight it to fellow Mac students.
On the DQ interface I get it, but not on my local Jupyter and I thought that continuing the SQL wouldn’t work without it. Anyway, I’ll keep going with the project and hopefully I don’t run into any errors around this.
Well I only did start my first project on DQ’s jupyter env, that too a portion of it. Once I started understanding Jup NB, I shifted to working on my local machine, so I never really noticed this difference.
I just tried it now and yup, it does give the connected message. May be the version is different.
Bruno here suggests the lab and NB difference but we are both using NB’s so really not sure why.