sqlite-utils 4.0rc1 adds migrations and nested transactions

· Source: Simon Willison's Weblog · Field: Technology & Digital — Software Development & Engineering, Data Science & Analytics · Depth: Intermediate, short

Summary

sqlite-utils 4.0rc1, released on June 21st, 2026, is the first release candidate for the v4 Python library and CLI tool for SQLite databases. This major version introduces two significant new features: database migrations and db.atomic() nested transactions. The migration system, a port of the sqlite-migrate package, allows users to define and apply schema changes through Python or a "migrate" CLI command, supporting operations like table creation and column additions. The db.atomic() feature provides a new API for managing nested transactions using SQLite savepoints, simplifying complex database operations. Additionally, sqlite-utils 4.0rc1 includes several backwards incompatible changes from its alpha releases, such as updated upsert syntax for SQLite versions later than 3.23.1, dropped support for Python 3.8, and a change in the default floating point column type to REAL.

Key takeaway

For Python developers and data engineers managing SQLite databases, upgrading to sqlite-utils 4.0rc1 offers significant enhancements. You should test this release candidate to evaluate the new migration system for schema evolution and the db.atomic() API for robust nested transactions. Be aware of the breaking changes, particularly regarding upsert behavior and type detection, and adjust your code or configurations accordingly to ensure smooth integration and prevent unexpected issues.

Key insights

sqlite-utils 4.0rc1 integrates database migrations and nested transactions, streamlining SQLite schema evolution and complex data operations.

Principles

Method

Define schema changes in "migrations.py" with @migrations() decorators, then apply via Python's "migrations.apply(db)" or "sqlite-utils migrate" CLI. Manage nested operations using "with db.atomic():" blocks.

In practice

Topics

Code references

Best for: Software Engineer, Data Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Simon Willison's Weblog.