New column_types system
Table columns can now have custom column types assigned to them, using the new column_types table configuration option or at runtime using a new UI and POST /<database>/<table>/-/set-column-type JSON API.
Built-in column types include url, email, and json, and plugins can register additional types using the new register_column_types() plugin hook. (#2664, #2671)
Column types can customize HTML rendering, validate values written through the insert, update, and upsert APIs, and transform values returned by the JSON API. They can optionally restrict themselves to specific SQLite column types using sqlite_types. This feature also introduces a new set-column-type permission for assigning column types to a table. (#2672)
The render_cell() plugin hook now receives a column_type argument containing the assigned type instance, and a column type's own render_cell() method takes priority over the plugin hook chain.
The datasette-files plugin will be the first to use this new feature.
UI for selecting columns and their order
Table and view pages now include a dialog for selecting and re-ordering visible columns. (#2661)
Other changes
- Fixed
allowed_resources("view-query", actor)so actor-specific canned queries are returned correctly. Any plugin that defines aresources_sql()method on aResourcesubclass needs to update to the new signature, see the resources_sql() method documentation for details. - Column actions can now be accessed in mobile view via a new "Column actions" button. Previously they were not available on mobile because table headers are not displayed there. (#2669, #2670)
- Row pages now render foreign key values as links to the referenced row. (#1592)
- The
startup()plugin hook now fires after metadata and internal schema tables have been populated, so plugins can reliably inspect that state during startup. (#2666)