Skip to content

1.0a3

Pre-release
Pre-release
Compare
Choose a tag to compare
@simonw simonw released this 09 Aug 19:17
· 254 commits to main since this release

This alpha release previews the updated design for Datasette's default JSON API. (#782)

The new default JSON representation for both table pages (/dbname/table.json) and arbitrary SQL queries (/dbname.json?sql=...) is now shaped like this:

{
  "ok": true,
  "rows": [
    {
      "id": 3,
      "name": "Detroit"
    },
    {
      "id": 2,
      "name": "Los Angeles"
    },
    {
      "id": 4,
      "name": "Memnonia"
    },
    {
      "id": 1,
      "name": "San Francisco"
    }
  ],
  "truncated": false
}

Tables will include an additional "next" key for pagination, which can be passed to ?_next= to fetch the next page of results.

The various ?_shape= options continue to work as before - see Different shapes for details.

A new ?_extra= mechanism is available for tables, but has not yet been stabilized or documented. Details on that are available in #262.

Smaller changes

  • Datasette documentation now shows YAML examples for Metadata by default, with a tab interface for switching to JSON. (#1153)
  • register_output_renderer(datasette) plugins now have access to error and truncated arguments, allowing them to display error messages and take into account truncated results. (#2130)
  • render_cell() plugin hook now also supports an optional request argument. (#2007)
  • New Justfile to support development workflows for Datasette using Just.
  • datasette.render_template() can now accepts a datasette.views.Context subclass as an alternative to a dictionary. (#2127)
  • datasette install -e path option for editable installations, useful while developing plugins. (#2106)
  • When started with the --cors option Datasette now serves an Access-Control-Max-Age: 3600 header, ensuring CORS OPTIONS requests are repeated no more than once an hour. (#2079)
  • Fixed a bug where the _internal database could display None instead of null for in-memory databases. (#1970)