sqlite-utils 4.0 发布,新增数据库 schema 迁移功能

sqlite-utils 4.0, now with database schema migrations

精选理由

Simon Willison 发布了 sqlite-utils 4.0,支持用 Python 定义数据库迁移,自动跟踪已执行步骤,还能处理 SQLite 不支持的 schema 变更。

AI 摘要

sqlite-utils 4.0 是该项目自2020年11月3.0以来的首个大版本,也是第124个版本。新增数据库迁移功能,允许用Python文件定义迁移序列,并通过_sqlite_migrations表跟踪已应用迁移。内置table.transform()方法模拟SQLite不支持的ALTER TABLE操作(创建临时表、复制数据、重命名)。还引入了嵌套事务(db.atomic()方法)和复合外键支持。

AI 翻译 · 中文

sqlite-utils 4.0 是该项目自2020年11月3.0以来的首个大版本,也是第124个版本。新增数据库迁移功能,允许用Python文件定义迁移序列,并通过_sqlite_migrations表跟踪已应用迁移。内置table.transform()方法模拟SQLite不支持的ALTER TABLE操作(创建临时表、复制数据、重命名)。还引入了嵌套事务(db.atomic()方法)和复合外键支持。

Simon Willison’s WeblogThis morning I released sqlite-utils 4.0 , the 124th release of that project and the first major version bump since 3.0 in November 2020. In addition to some small but significant breaking changes (described in this upgr