Skip to main content

Make selected Datasette databases and tables visible to the public

Project description

datasette-public

PyPI Changelog Tests License

Make selected Datasette databases, tables and queries visible to the public

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-public

Usage

This plugin can only be used with Datasette 1.0a+ and requires Datasette to be run with a persistent internal database:

datasette --internal internal.db data.db

To grant datasette-public permission to the root user run the following:

datasette --internal internal.db data.db --root \
  -s permissions.datasette-public.id root

New database, table and query action menu items allow users with the datasette-public permission to toggle databases, tables and queries between public and private.

For databases, users can also select if the ability to execute arbitrary SQL should be exposed to the public.

If a table is public but the database is private, users will not we able to use the ?_where= parameter on that table.

The interfaces for managing the visibility of databases, tables and queries include an audit log of changes that have been made to their public status.

Internals

This plugin uses four tables in the internal database:

  • public_databases - stores the public status of databases and if execute SQL is enabled
  • public_tables - stores the public status of tables
  • public_queries - stores the public status of queries
  • public_audit_log - stores the history of changes to the public status of databases, tables and queries

Development

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

cd datasette-public
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

In local development it's useful to run Datasette with everything made private by default:

datasette data.db \
  --internal internal.db \
  -s allow.id root \
  -s permissions.datasette-public.id root \
  --root \
  --secret fixed \
  --reload

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_public-0.3a4.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datasette_public-0.3a4-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file datasette_public-0.3a4.tar.gz.

File metadata

  • Download URL: datasette_public-0.3a4.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for datasette_public-0.3a4.tar.gz
Algorithm Hash digest
SHA256 e722849d9a12f4bbd4c560ff56b53f6ebac10088c2bb978fb6fe7e62cc2cfbf3
MD5 6f8c05f3c71b700f1b7348f5d02b3a6c
BLAKE2b-256 bbfb1104e70f8a8858d0ebf0c74e895a407a4a303200b51c5fdd32c4db54694e

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_public-0.3a4.tar.gz:

Publisher: publish.yml on datasette/datasette-public

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datasette_public-0.3a4-py3-none-any.whl.

File metadata

File hashes

Hashes for datasette_public-0.3a4-py3-none-any.whl
Algorithm Hash digest
SHA256 e5b8c35a77574810fc6079a92cd448e97d07a5fe184b77f1406198aa107c8a71
MD5 d129039e58dd6e8e1d35d1011db9bee7
BLAKE2b-256 ea9e9b968f062710cef9d5bd76270188c7159fd45f353500e3219e4c6a400286

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_public-0.3a4-py3-none-any.whl:

Publisher: publish.yml on datasette/datasette-public

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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