Needed by db-to-sqlite. It currently works by collecting all of the foreign key relationships it can find and then applying them at the end of the process.
The problem is, the add_foreign_key() method looks like this:
# Have to VACUUM outside the transaction to ensure .foreign_keys property
# can see the newly created foreign key.
cursor.execute("VACUUM")
That means it's doing a full VACUUM for every single relationship it sets up - and if you have hundreds of foreign key relationships in your database this can take hours.
I think the right solution is to have a .add_foreign_keys(list_of_args) method which does the bulk operation and then a single VACUUM. .add_foreign_key(...) can then call the bulk action with a single list item.
The text was updated successfully, but these errors were encountered:
Needed by db-to-sqlite. It currently works by collecting all of the foreign key relationships it can find and then applying them at the end of the process.
The problem is, the
add_foreign_key()
method looks like this:sqlite-utils/sqlite_utils/db.py
Lines 498 to 516 in 86bd2bb
That means it's doing a full
VACUUM
for every single relationship it sets up - and if you have hundreds of foreign key relationships in your database this can take hours.I think the right solution is to have a
.add_foreign_keys(list_of_args)
method which does the bulk operation and then a singleVACUUM
..add_foreign_key(...)
can then call the bulk action with a single list item.The text was updated successfully, but these errors were encountered: