Skip to main content

Upload SQLite database files to Datasette

Project description

datasette-upload-dbs

PyPI Changelog Tests License

Upload SQLite database files to Datasette

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-upload-dbs

Configuration

This plugin requires you to configure a directory in which uploaded files will be stored.

On startup, Datasette will automatically load any SQLite files that it finds in that directory. This means it is safe to restart your server in between file uploads.

To configure the directory as /home/datasette/uploads, add this to a metadata.yml configuration file:

plugins:
  datasette-upload-dbs:
    directory: /home/datasette/uploads

Or if you are using metadata.json:

{
  "plugins": {
    "datasette-upload-dbs": {
      "directory": "/home/datasette/uploads"
    }
  }
}

You can use "." for the current folder when the server starts, or "uploads" for a folder relative to that folder. The folder will be created on startup if it does not already exist.

Then start Datasette like this:

datasette -m metadata.yml

Usage

Only users with the upload-dbs permission will be able to upload files. The root user has this permission by default - other users can be granted access using permission plugins, see the Permissions documentation for details.

To start Datasette as the root user, run this:

datasette -m metadata.yml --root

And follow the link that is displayd on the console.

If a user has that permission they will see an "Upload database" link in the navigation menu.

This will take them to /-/upload-dbs where they will be able to upload database files, by selecting them or by dragging them onto the drop area.

Animated demo showing a file being dropped onto a box, then uploading and redirecting to the database page

Development

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

cd datasette-upload-dbs
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-upload-dbs-0.1.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

datasette_upload_dbs-0.1.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file datasette-upload-dbs-0.1.1.tar.gz.

File metadata

  • Download URL: datasette-upload-dbs-0.1.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for datasette-upload-dbs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 34fcead0fa2b8ceb2b220894e4dc5d48a5799ac6d16a63b57d297e684bec9c46
MD5 1ee1e3da7d0079831157270ff90fa56d
BLAKE2b-256 77e23e5d8c3356100085b0df02e23db04a79e5fe6601abc7d4c6b920302473ab

See more details on using hashes here.

File details

Details for the file datasette_upload_dbs-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for datasette_upload_dbs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1248612750dfd9d718fd79fe300b39cc6ea370f423aa3afbf0ed9abd61d764fc
MD5 6310d38fef95bf2b3f71b696805a9b50
BLAKE2b-256 f68b7f2c9f1818518f55b7badc003e29a2549d02e1031a21fcc87810f86bb044

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