sqlite-utils 4.0rc1 Brings Migrations and Nested Transactions
TL;DR
- Simon Willison released sqlite-utils 4.0rc1, folding migration support from his sqlite-migrate package into the core library.
- A new db.atomic() context manager adds savepoint-based nested transactions, borrowing terminology from Django and Peewee.
- Version 4.0 drops Python 3.8, switches upsert syntax to require SQLite 3.23.1+, and moves the tui command to a separate plugin.
Simon Willison's sqlite-utils, a Python library and CLI tool for SQLite database operations, has its first release candidate for version 4.0, and the two headline additions are worth paying attention to: a built-in migration system and savepoint-based nested transactions.
The migration support was adapted from Willison's earlier sqlite-migrate package, which he notes "has been used by LLM and various other projects for several years," giving the design a credible track record before being folded into the core library. Migrations are defined as decorated Python functions and can be executed from Python code or the CLI. There are no reverse migrations by design: the stated intent is to push developers toward fixing mistakes through new forward migrations rather than rollbacks.
The second addition is `db.atomic()`, a context manager that enables nested transactions using SQLite savepoints. The terminology is borrowed from Django and Peewee, so developers familiar with those frameworks will recognize the pattern immediately. Willison flags that this feature "deserves more attention from testers" compared to the migrations system, which is the more road-tested of the two.
The version bump comes with several breaking changes worth reviewing before upgrading. Upsert syntax now uses SQLite's `INSERT ... ON CONFLICT SET`, which requires SQLite 3.23.1 or newer. Python 3.8 support is dropped in favor of 3.13. The default floating-point column type changes from FLOAT to REAL, and the `sqlite-utils tui` command moves to a separate plugin package. What the announcement does not address is a timeline for the stable 4.0 release, a formal guide for users of the standalone sqlite-migrate package, or how the no-reverse-migrations design holds up in multi-environment workflows where rollback matters.
For teams already using sqlite-migrate alongside sqlite-utils in projects like LLM, the path to dropping that extra dependency becomes clearer once 4.0 stable ships. The rc1 label is an active invitation: feedback goes to the sqlite-utils Discord channel and GitHub Issues, and now is the time to test the breaking changes list against a real codebase rather than after stable lands.
Shared on Bluesky by 2 AI experts
-
Simon Willison @simon.fedi.simonwillison.net.ap.brid.gy: I just released the first release candidate for sqlite-utils v4, adding a migrations system (previously released independently as sqlite-mig… →
Originally reported by simonwillison.net
Read the original article →Original headline: sqlite-utils 4.0rc1 adds migrations and nested transactions