Hi, my code produces an error and I don’t know what is wrong with it. I checked the solution, and even tried to copy it from the solution notebook but still produce the foreign key mismatch error.
Code as follows: errors at the bottom
Code for appearance_type:
with sqlite3.connect('mlb.db') as conn: c='DROP TABLE IF EXISTS appearance_type;' run_command_del(c) appearance.to_sql('appearance_type', conn, index=False, if_exists = 'append')
Code for person_appearance is copied from solution
This is my error message:
OperationalErrorTraceback (most recent call last) <ipython-input-41-9b62c94a7243> in <module>() 158 """ 159 --> 160 run_command(c2) <ipython-input-13-12da1162681e> 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 df = ''' **OperationalError: foreign key mismatch - "person_appearance" referencing "appearance_type"**
Can you help me deduce why is my code getting this error?