diff options
Diffstat (limited to 'dedup')
-rw-r--r-- | dedup/utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/dedup/utils.py b/dedup/utils.py index 2fae9fd..e4d1c10 100644 --- a/dedup/utils.py +++ b/dedup/utils.py @@ -1,3 +1,5 @@ +import sqlalchemy.event + def fetchiter(cursor): rows = cursor.fetchmany() while rows: @@ -5,3 +7,8 @@ def fetchiter(cursor): yield row rows = cursor.fetchmany() +def enable_sqlite_foreign_keys(engine): + @sqlalchemy.event.listens_for(engine, "connect") + def pragma_foreign_keys(connection, _): + connection.execute("PRAGMA foreign_keys=ON;") + |