Skip to main content

Enable downloading mutable databases.

Project description

datasette-mutable-downloads

PyPI Changelog Tests License

Enable downloading mutable databases.

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-mutable-downloads

Usage

You can now download a mutable database on its database page, just as you can for immutable databases.

Example: https://dux.fly.dev/cooking

Notes

This is achieved by a somewhat gross monkeypatch of the DatabaseDownload view.

We detect if the database is mutable. If it is, we first create a copy via VACUUM INTO.

We then stream that file to the user, and delete it.

This requires SQLite 3.27.0 or newer (Feb 2019).

NOTE

The act of VACUUM INTO could be resource intensive if your database is large. If you expose your Datasette to the Internet, you may wish to restrict this to only authenticated users.

To do that, add a permissions block in your metadata.json:

"permissions": {
  "view-database-download": {
    "gh_id": "*"
  }
}

Development

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

cd datasette-mutable-downloads
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-mutable-downloads-0.1.2.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

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