SQL Guided Project: Designing and creating a Database

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

can anyone help me?
Thanks
Nolla

Hey there - it sounds like there’s some operation that goes forever (like a long running loop), but it’s hard to understand exactly what’s going on here without seeing the code.

The guide below shows how you can share your notebook into a thread, I would suggest doing that and seeing if anyone is able to suggest what might be causing the behavior you’re seeing.

Hi Joshdq,
here is my notebook Basics (1).ipynb (186.3 KB) , can you help me? thanks

Click here to view the jupyter notebook file in a new tab

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>()
    199 
    200 run_command(c1)
--> 201 run_command(c2)
    202 
    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 hope this is helpful

Hallo Joshdq,

I don’t get any feedback at all, not even saying something about any error. it seems like it stop running . maybe i should just start from the beginning.

thanks for the help

Hi Nomul,

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. :slight_smile:

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
Screenshot 2020-02-05 at 15.01.59

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.

Would love to hear if it works for you!

1 Like

Hallo Brileilani,

It works!!
Thanks a lot

1 Like