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.3a3.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.3a3-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for datasette_public-0.3a3.tar.gz
Algorithm Hash digest
SHA256 dcf2f1eda467ba5d80794a8fbd3a73154afbeae441f1ee3543b3d29a466d79d3
MD5 868202865146c3a39de63fc8e59dbace
BLAKE2b-256 8cfa08ceb9207dcfd8f6c3af76f5730df397df1fa4cf66200dc5cded90ca382e

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_public-0.3a3.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.3a3-py3-none-any.whl.

File metadata

File hashes

Hashes for datasette_public-0.3a3-py3-none-any.whl
Algorithm Hash digest
SHA256 9b44960dd7dac4ff02d5da7b4c48009bf11526bca845f43f6241585133c16956
MD5 9e10b1db237d7178370913ee752c2b23
BLAKE2b-256 74cf4c0bbc7f2bdc52bacf0cf637a9cb69c4ff5a4564e58dd2d1b45e7d3f5e76

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_public-0.3a3-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