sqlite-utils 4.0, now with database schema migrations
sqlite-utils 4.0 was released on July 7, 2026, representing the 124th release and the first major version bump since sqlite-utils 3.0 in November 2020. This update introduces three main features: database schema migrations, nested transactions through a new `db.atomic()` method, and support for compound foreign keys. The database schema migrations feature allows users to define a sequence of changes for a SQLite database within Python files, using the sqlite-utils library. It includes a mechanism to track applied and pending migrations. Migrations leverage the `table.transform()` method, which provides enhanced `ALTER TABLE` capabilities not natively supported by SQLite, by creating a temporary table, copying data, and renaming. A new `_sqlite_migrations` table is used to record which migration functions have been executed. Users can apply migrations via the command line with `uvx sqlite-utils migrate data.db migrations.py` or programmatically using `migrations.apply(db)`. This migration design, originally released as the `sqlite-migrate` package, has now been promoted to a core feature of `sqlite-utils`. Unlike Django’s migrations, `sqlite-utils` encourages programmatic table creation and does not automatically generate migrations or include a rollback feature, suggesting users copy their database file for rollback purposes.
Developers can now manage SQLite database schema changes directly within `sqlite-utils` using Python-defined migrations, simplifying database evolution.