sqlite-utils 4.0, now with database schema migrations
The release of sqlite-utils 4.0 marks the first major version update for the project since 2020. This version introduces three primary features: a structured system for database schema migrations, support for nested transactions via a new atomic method, and the ability to handle compound foreign keys. These additions are designed to make managing evolving database schemas safer and more consistent across different tools.
The new migration system allows developers to define a sequence of schema changes in Python files. It tracks which migrations have been applied to a database using a dedicated internal table, ensuring that only pending updates are executed. This system replaces the previous standalone sqlite-migrate package, integrating the functionality directly into the core library to provide a more stable and accessible toolset for users.
Beyond these new features, version 4.0 includes several breaking changes intended to improve long-term library quality. These include updates to how upserts are handled, a shift in how queries are executed to distinguish between reads and writes, and improved default type detection for imported data. The developer utilized AI-assisted programming to identify bugs and refine the API design during the release process. These changes are intended to provide a more robust foundation for the library, with the major version bump signaling a commitment to long-term stability.