title: Fixing Integrity Error in Python
body: <p>When you're trying to debug a program in python that pulls from a few other databases/folders. After looking up what the integrity error means, how do you find out where it is happening exactly? Is there a command you can insert into the code that will print out where that error is happening? A try/except clause maybe?</p>
  
  <p>Examples of errors I ran into:</p>
  
  <p>sqlalchemy.exc.IntegrityError: (_mysql_exceptions.IntegrityError) (1364, "Field 'id' doesn't have a default value")</p>
  
  <p>sqlalchemy.exc.IntegrityError: (_mysql_exceptions.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (<code>hbnb_dev_db</code>.<code>cities</code>, CONSTRAINT <code>cities_ibfk_1</code> FOREIGN KEY (<code>state_id</code>) REFERENCES <code>states</code> (<code>id</code>))')</p>