Skip to main content

Export pages from Datasette to files on disk

Project description

datasette-export

PyPI Changelog Tests License

Export pages from Datasette to files on disk

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-export

Usage

This plugin adds a new export command. You can use this to export one or more pages from Datasette to files on disk.

Pass the --path option one or more times to specify pages:

datasette export mydata.db --path / --path /mydata.json --path /mydata/table1.csv

This will create an export/ directory and save the following files to it:

  • index.html
  • mydata.json
  • mydata/table1.csv

Use --output to specify an alternative directory for the export:

datasette export mydata.db --path / --output mywebsite/

In addition to specifying paths, you can pass one or more SQL queries that can return lists of pages to be exported:

datasette export mydata.db --sql "select path from pages"

For example, to export JSON for every row in the fixtures/facetable table:

datasette export fixtures.db \
  --sql "select '/fixtures/facetable/' || pk || '.json' from facetable"

Development

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

cd datasette-export
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-export-0.1a0.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

datasette_export-0.1a0-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

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