datasette 1.0a35 让数据库操作直观多了,直接点几下就能建表和改结构,不用写 SQL,还有稳定的模板文档。
datasette 1.0a35 发布,带来三项重要更新。新“创建表”界面支持定义列、主键、自定义类型、NOT NULL 约束、默认值、表达式默认值和单列外键,同时提供 JSON API。新“修改表”界面支持添加、重命名、重新排序和删除列,修改类型、默认值、约束、主键和外键,并包含删除表按钮。新增模板上下文文档,列出核心页面可用变量,被视为自定义模板的稳定 API 直至 2.0,文档由数据类定义生成并附带测试。
datasette 1.0a35
Release: datasette 1.0a35 I'll write more about this one tomorrow, but it's a big release. Three highlights from the release notes: New "Create table" interface in the database actions menu, backed by the /<database>/-/create JSON API . It can define columns, primary keys, custom column types, NOT NULL constraints, literal defaults, expression defaults and single-column foreign keys. ( #2787 ) New "Alter table" table action and /<database>/<table>/-/alter JSON API for changing existing tables: add, rename, reorder and drop columns; change column types, defaults, NOT NULL constraints, primary keys and foreign keys; and rename the table. The alter table dialog also includes a "Drop table" button. ( #2788 ) New Template context documentation listing the variables available to custom templates for Datasette's core pages. Variables documented there are treated as a stable API for custom templates until Datasette 2.0. The documentation is generated from dataclass definitions next to the view code, with tests that compare the documented fields against the actual contexts rendered by the database, table, query and row pages. ( #1510 , #2127 , #1477 , #2803 ) Here's a rough video demo I made of the new create/alter table feature as part of reviewing the PR : Tags: datasette