Datasette plugin for modifying table schemas
Project description
datasette-edit-schema
Datasette plugin for modifying table schemas
Features
- Add new columns to a table
- Rename columns in a table
- Modify the type of columns in a table
- Re-order the columns in a table
- Rename a table
- Delete a table
- Change the primary key of a table to another column containing unique values
- Update the foreign key constraints on a table
- Add an index (or unique index) to a column on a table
- Drop an index from a table
Installation
Install this plugin in the same environment as Datasette.
pip install datasette-edit-schema
Usage
Navigate to /-/edit-schema/dbname/tablename on your Datasette instance to edit a specific table.
Use /-/edit-schema/dbname to create a new table in a specific database.
By default only the root actor can access the page - so you'll need to run Datasette with the --root option and click on the link shown in the terminal to sign in and access the page.
Permissions
The edit-schema permission governs access. You can use permission plugins such as datasette-permissions-sql to grant additional access to the write interface.
These permission checks will call the permission_allowed() plugin hook with three arguments:
actionwill be the string"edit-schema"actorwill be the currently authenticated actor - usually a dictionaryresourcewill be the string name of the database
Screenshot
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-edit-schema
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datasette-edit-schema-0.7.1.tar.gz.
File metadata
- Download URL: datasette-edit-schema-0.7.1.tar.gz
- Upload date:
- Size: 67.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7de83533bbb441ed0f392b2cae9a2871931be917f69cbad1d60c79cac1dbe08
|
|
| MD5 |
7da6d26c2fa7ff09ebab22ec0a0395c5
|
|
| BLAKE2b-256 |
5cb5d1398bf4f856585bddebeae6f3439d46d477e062e6db146095b74d89178f
|
File details
Details for the file datasette_edit_schema-0.7.1-py3-none-any.whl.
File metadata
- Download URL: datasette_edit_schema-0.7.1-py3-none-any.whl
- Upload date:
- Size: 65.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
060dbd8d0c96038aafd7d8efcb5efdf98f785edd4603eca555678e47f5efcbf1
|
|
| MD5 |
34402e480af5b3626bc8f24463f2521a
|
|
| BLAKE2b-256 |
f9e64301d73526617ca1f7b90b7e275fd0547d8c297228b68ebdbf7c9c45fa0b
|