github simonw/datasette 1.0a25

pre-release3 hours ago

write_wrapper plugin hook for intercepting write operations

A new write_wrapper() plugin hook allows plugins to intercept and wrap database write operations. (#2636)

Plugins implement the hook as a generator-based context manager:

@hookimpl
def  write_wrapper(datasette, database, request):
    def  wrapper(conn):
        # Setup code runs before the write
        yield
        # Cleanup code runs after the write

    return wrapper

register_token_handler() plugin hook for custom API token backends

A new register_token_handler() plugin hook allows plugins to provide custom token backends for API authentication. (#2650)

This includes a backwards incompatible change: the datasette.create_token() internal method is now an async method. Consult the upgrade guide for details on how to update your code.

render_cell() now receives a pks parameter

The render_cell() plugin hook now receives a pks parameter containing the list of primary key column names for the table being rendered. This avoids plugins needing to make redundant async calls to look up primary keys. (#2641)

Other changes

  • Facets defined in metadata now preserve their configured order, instead of being sorted by result count. Request-based facets added via the _facet parameter are still sorted by result count and appear after metadata-defined facets. (#2647)
  • Fixed --reload incorrectly interpreting the serve command as a file argument. Thanks, Daniel Bates. (#2646)

Don't miss a new datasette release

NewReleases is sending notifications on new releases.