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