I am working in Guided Project Designing and Creating a Database, but the in the middle the jupiter notebook would not run my code, it stop in the middle, i have already tried to restart couple times, but still not working. And the download button also not working
This is helpful, because when I ran the notebook I got an error:
OperationalError Traceback (most recent call last)
<ipython-input-27-b194352656d8> in <module>()
--> 201 run_command(c2)
203 for hv in ["h", "v"]:
<ipython-input-15-e260aa66b002> in run_command(c)
13 conn.execute('PRAGMA foreign_keys = ON;')
14 conn.isolation_level = None
---> 15 conn.execute(c)
16 def show_tables():
17 q = '''
OperationalError: no such table: main.appearance_type
Do you get this same error? If so, it should point you towards the query that has the issue, where you can look to find what is causing this to fail.
If you’re not getting the error, there could be something awry with the mlb.db database you created - I would try deleting this and then running your code again, and see if you get the same error as I did.
I’m not sure if you were able to resolve this, but I had a similar issue and I wasn’t getting back an error message so I thought I’d provide a bit of context in case it might help you or someone else.
It seems like an issue with the database retaining state and interestingly, mine stopped running in the exact same place that yours did which was when creating the ‘game’ table. I’m not sure exactly why it was at this point that it started facing issues as the only thing that seems to be different is that every table from ‘game’ onwards pulls from ‘game_log’. (If anyone at DQ has any insight, I’d love to understand it better!)
I was able to figure out what the problem was by looking at the tables in the database which was created in an earlier cell. It looks like you are facing the same issue as I looked at your notebook and took the below screenshot of the tables in your database
See how it’s still showing that you already have the tables ‘game’, ‘team_appearance’ and ‘person_appearance’ even though the code stops running before you get to ‘game’?
Because it’s an issue with state, it’s a simple fix as Josh suggested above. You can just insert a cell at the start of your code and enter the shell command !rm mlb.db then run all cells again.
This will clear your database so that each cell that runs after it will establish your database in the order that you want to and you should no longer face the issue.