Datasette plugin providing a UI for writing to a database
Project description
datasette-write
Datasette plugin providing a UI for writing to a database
Installation
Install this plugin in the same environment as Datasette.
pip install datasette-write
Usage
Having installed the plugin, visit /-/write
on your Datasette instance to submit SQL queries that will be executed against a write connection to the specified database.
By default only the root
user 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.
The datasette-write
permission governs access. You can use permission plugins such as datasette-permissions-sql to grant additional access to the write interface.
Pass ?sql=...
in the query string to pre-populate the SQL editor with a query. Pass ?database=...
to specify a database to run the query against.
Parameterized queries
SQL queries can include parameters like this:
insert into news (title, body)
values (:title, :body_textarea)
These will be converted into form fields on the /-/write
page.
If a parameter name ends with _textarea
it will be rendered as a multi-line textarea instead of a text input.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-write
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_write-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a9cfc5ff83274159a72b32216983435dfba315a0ad6e18a514f362ec96a2223 |
|
MD5 | a4bac8bcce9db1ee83404faca549cf80 |
|
BLAKE2b-256 | f73ec1ed4ae9f83c899d4ad5c1f92b84e51846fe31e4853b410d0c0b5bd773b6 |