Skip to main content

Configure Datasette to block operations using the SQLite set_authorizer mechanism

Project description

datasette-sqlite-authorizer

PyPI Changelog Tests License

Configure Datasette to block operations using the SQLite set_authorizer mechanism

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-sqlite-authorizer

Usage

This plugin currently offers a single configuration option: read_only_tables. You can use this to specify a list of tables that should be read-only.

If a table is read-only, any attempt to write to it - insert, update, delete, drop table, alter table - will be denied with an error message.

To configure read-only tables, add the following to your metadata.yaml file:

plugins:
  datasette-sqlite-authorizer:
    read_only_tables:
    - table: my_table
      database: my_database

You can omit the database key if you want to apply the same rule to all databases.

Here's how to use this plugin to make all tables relating to Litestream synchronization read-only, across all attached databases:

plugins:
  datasette-sqlite-authorizer:
    read_only_tables:
    - table: _litestream_lock
    - table: _litestream_seq

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-sqlite-authorizer
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datasette-sqlite-authorizer-0.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file datasette-sqlite-authorizer-0.1.tar.gz.

File metadata

File hashes

Hashes for datasette-sqlite-authorizer-0.1.tar.gz
Algorithm Hash digest
SHA256 c138d7a309e22b848d9a51aec0c4aba13693442c46f277e774a443354a86fb6a
MD5 083801208f33b48ede0e748cc84f13ea
BLAKE2b-256 0622e1e4f27767fbef43514cfdd6743f95dc61200e67ab643b33425d3e43c4d3

See more details on using hashes here.

File details

Details for the file datasette_sqlite_authorizer-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for datasette_sqlite_authorizer-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f94dfc75ac8c98bdb8534c9e688f40d4aeb0be9ee03a4baf0e76db7acf89edd
MD5 5c39c31f388053c469cb3dcfaa740382
BLAKE2b-256 2a07a9791dc90e5b8b5294edb801a235330d05975369631496daa13d369e70b2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page