Comment 5 for bug 991913

Revision history for this message
Rafael Durán Castañeda (rafadurancastaneda) wrote :

SQLite can check for foreign keys too if properly configured. We need just define:

def on_checkout(dbapi_con, connection_rec, connection_proxy):
    db_cursor = dbapi_con.execute('pragma foreign_keys=ON')

And then use it when the engine is created:

from sqlalchemy import events

if options['sql_connection'].startswith('sqlite'):
            events.event.listen(_ENGINE, 'checkout', on_checkout)

I think we should add something like this for SQLite so we can catch integrity errors in SQLite development enviro instead of MySQL (ot whatever RDBMS people is using).