I just finished the guided project Answering Business Questions using SQL and now I’d like view this project on my Jupyter notebook. However, I do not know how to load the database. This is what I’m running:
This code does not return any errors and the data database seems to be loaded, but when I write any query it says the tables do not exist, for example:
* sqlite:///chinook.db
(sqlite3.OperationalError) no such table: track
Also, when I run a query to see all the tables I get this:
Fala Bruno, tudo bem? Que bom que tem mais falantes de português por aqui!
I tried to use both sqlalchemy and Jupyter magics because that’s how I got the World Factbook project to work. You can see it here. But now I tried to run it (the factbook project) with only the Jupyter magics and it also worked. There’s a long time that I finished that project so I do not remember what was was going on exactly
But for the Chinook project, I tried now only with the Jupyter magics and the same thing is happening. I do not understand why one project works an the other doesn’t.
It seems that chinook.db is empty. You probably never downloaded the file and the reason why the file even exists is because it is created when you try to connect to it.
Can you please attach your chinook.db just to confirm this?
Downloading the chinook.db file and placing it in that directory should fix your issues.
I don’t know where to download it. I couldn’t find any info where and how to download it ( firstly thought that this code above - this from the first page of SQL mission “Answering Business Questions Using SQL” - will download it directly from web, but it seems that it does something else).
I am assuming by “SQL mission” you are referring to the Guided Project of that name.
There’s a Download button at the top of the Jupyter Notebook in the classroom. It downloads all the project-related files including your Notebook and the dataset as well. If you download and then unzip the file you will get the chinook.db file.
%% (cell magic commands) should apparently be executed first (so before your import statement, or you can split the cells which you seem to have done already) - https://github.com/jupyter/notebook/issues/5269 That should work, I believe.