sqlite-utils 4.1.1 patches a silent data destruction bug in table.transform(). When PRAGMA foreign_keys is enabled and a table has foreign key relationships with CASCADE, SET NULL, or SET DEFAULT ON DELETE actions, calling transform() would drop the old table mid-operation and silently fire those delete actions, corrupting or erasing referencing rows without any warning.
The fix raises a TransactionError before any damage occurs. The root cause is a SQLite constraint: PRAGMA foreign_keys cannot be toggled inside an open transaction, so the library could not safely disable it during the transform. Claude 4.1 spotted the edge case while the author was experimenting with the previous release to answer a question about ON DELETE behavior.
The release also adds bidirectional cross-referencing between the CLI and Python API documentation, issue #791. The bug fix is the reason to read the full release notes: the workarounds section at sqlite-utils.datasette.io covers how to safely run transforms when foreign key constraints are active.
[READ ORIGINAL →]