I am trying to follow along with the video by using Colab.
I managed to open this notebook in Colab: github/ine-rmotr-curriculum/RDP-Reading-Data-with-Python-and-Pandas/blob/master/unit-1-reading-data-with-python-and-pandas/lesson-11-reading-data-from-relational-databases/files/Lecture.ipynb
when I tried to run the command:
cur.execute('SELECT * FROM employees LIMIT 5;')
I got an error saying No such table
I then ran the following commands:
sql_query = 'SELECT name FROM sqlite_master WHERE type="table";'
cur.execute(sql_query)
print(cur.fetchall())
and got an empty []
I thought perhaps the Chinook database was corrupt so I deleted it and tried to upload it from the Github site but just get this:
Only thing I can think is maybe the DB wasn’t fully or correctly installed, or maybe the code before this where it connected to the DB didn’t finish correctly or something.
Thank you for replying. I think I tried all that but still didn’t work. So, please could you tell me:
a) how did you start your Colab
b) what steps you took to copy the workbook to your Colab
c) what steps you took to copy the DB over
b) I go to File → Open Notebook, selected GitHub at the top, entered the github username for the repository (“ine-rmotr-curriculum”), click search icon, selected the repository, then selected lesson 11 (the one you’re working on).
c) From the repository I linked above, click the DB file… as there is no preview it will just look blank, but you can select download to download the file locally. Once its downloaded locally, I just drag and drop it from my local folder to the colab:
That will allow you to work on the notebook, but its not a local copy, so you won’t be able to save anything. If you hit CTRL+S to save, it will pop up the below warning:
And from there you can save a copy to your Google Drive for you to work on. There is also options to save to your github or elsewhere under the File menu.
Yeah, I’m at a loss, but do believe it has something to do with this:
Maybe indicating that the chinook.db was not getting fully uploaded. Seems to work for you locally so the DB file is downloaded to your system correctly, but maybe something in Colab isn’t allowing the upload, firewall maybe, browser issue(could try another browser) or maybe you didn’t wait long enough for it to finish uploading. (For me the upload only took like 10 seconds though)
Sadly I’m at a loss aside from maybe those suggestions… all I could really atest to is what I did and that it worked for me.
Thanks. I’ve been using Firefox. I then tried with Edge and it worked so I guess the problem lies with Firefox. I looked at settings but couldn’t see anything helpful. Do you have any suggestions that I could try to get Firefox working. If not, I’ll just use Edge for this
Not really. I use Firefox Dev Edition and it worked. Clear cache and cookies would be my only suggestion as a just in case. I don’t know of anything else that might prevent file upload.