Ensure specific tables and views exist on startup
Project description
datasette-init
Ensure specific tables and views exist on startup
Installation
Install this plugin in the same environment as Datasette.
$ pip install datasette-init
Usage
This plugin is configured using metadata.json
(or metadata.yaml
). Add a block like this that specifies the tables you would like to ensure exist:
{
"plugins": {
"datasette-init": {
"my_database": {
"tables": {
"dogs": {
"columns": {
"id": "integer",
"name": "text",
"age": "integer",
"weight": "float",
},
"pk": "id"
}
}
}
}
}
}
Any tables that do not create will be created when Datasette first starts.
Valid column types are "integer"
, "text"
, "float"
and "blob"
. The "pk"
is optional.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-init
python3 -mvenv venv
source venv/bin/activate
Or if you are using pipenv
:
pipenv shell
Now install the dependencies and tests:
pip install -e '.[test]'
To run the tests:
pytest
Project details
Release history Release notifications | RSS feed
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
Hashes for datasette_init-0.1a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0527cfb73877c15f5d47218a6903c18af27211ec7df5819974f56945e3f88e0b |
|
MD5 | a42cc470246f0661ce5dc5689834e10d |
|
BLAKE2b-256 | bc64f408c7c5678d06a1af289826a8768c08f5c76f0773299e76f60d5b39585c |