sqlite-utils 4.0rc1 ships bundled migrations and Django-style nested transactions
Simon Willison released sqlite-utils 4.0rc1, the first release candidate for the major v4 of his widely-used Python library and CLI tool for working with SQLite databases. The headline addition is a built-in migrations system — a port of his standalone sqlite-migrate package, which has already seen real-world use in projects like his own LLM CLI tool. Migrations are defined as decorated Python functions and can be run via either the Python API (migrations.apply(db)) or a new sqlite-utils migrate CLI command.
The second new feature is db.atomic(), a context-manager API for nested transactions backed by SQLite savepoints — borrowing the 'atomic' terminology from Django and Peewee. It allows inner transaction blocks to roll back independently without unwinding the outer transaction. The release also carries several breaking changes: upsert now uses INSERT … ON CONFLICT SET syntax, the default float column type changes from FLOAT to REAL, table.convert() no longer skips falsy values, and CSV/TSV imports now auto-detect types by default. Python 3.8 is dropped; 3.13 is supported. The RC can be tested via pip install sqlite-utils==4.0rc1 or uvx.
Sources
- Primary source
- Simon Willison on Bluesky
“I just released the first release candidate for sqlite-utils v4, adding a migrations system (previously released independently as sqlite-migrate) and support for nested transactions”