Upload SQLite database files to Datasette
Project description
datasette-upload-dbs
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
The plugin defaults to loading all databases in the configured directory.
You can disable this by adding the following setting:
"skip_startup_scan": true
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.
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
Built Distribution
File details
Details for the file datasette-upload-dbs-0.2.tar.gz
.
File metadata
- Download URL: datasette-upload-dbs-0.2.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea0e358c056dc4180f34c7afe17b2865587d50e1402157039d1ad34d2ecbda62 |
|
MD5 | 4a004efba4c5668a66a4fe54fec354b5 |
|
BLAKE2b-256 | 4eaf19c8eee9f258fb36c90c5168f904d01956181a9eb1c43efd671e4081a974 |
File details
Details for the file datasette_upload_dbs-0.2-py3-none-any.whl
.
File metadata
- Download URL: datasette_upload_dbs-0.2-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6eca41af2127cbac2a068b58bfd570a44f8750266f8291164884b1af9df8ab04 |
|
MD5 | 261774911be30fece16f6b4a64feb222 |
|
BLAKE2b-256 | 7a4426f5785a9ed1ca4ecff7bb21e61790398e75c39eaf978f5e5b19034f5f9a |