Skip to main content

datasette-write

PyPI Changelog Tests License

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 /db/-/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.

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 /db/-/write page.

If a parameter name ends with _textarea it will be rendered as a multi-line textarea instead of a text input.

If a parameter name ends with _hidden it will be rendered as a hidden input.

Updating rows with SQL

On Datasette 1.0a13 and higher a row actions menu item will be added to the row page linking to a SQL query for updating that row, for users with the datasette-write permission.

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

Metadata

Release files for datasette-write 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datasette-write 0.4
File Size Uploaded Provenance Actions
datasette_write-0.4.tar.gz 9.8 kB Without provenance Details for datasette_write-0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datasette-write 0.4
File Interpreter ABI Platform Actions
datasette_write-0.4-py3-none-any.whl Python 3 none any Details for datasette_write-0.4-py3-none-any.whl

Total release size: 17.3 kB

Release files / datasette_write-0.4.tar.gz

Download URL datasette_write-0.4.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4b599b05950921b1bceb7a800583de9d7cf2b1071d642ba16fbb2df13d47f665
BLAKE2b-256 checksum
How to use checksums
a22952216a9a0d16c4f8e188436b7fb66c08af7a553a6379091b306f01ac8303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / datasette_write-0.4-py3-none-any.whl

Download URL datasette_write-0.4-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
810b55b65cc0383d406fa6cd14a0f642280700cacddf683505f58c14f1928849
BLAKE2b-256 checksum
How to use checksums
3ad12dc625b79d8d21ae1066f0a5060a6ea84c1ef8073bc1dd4d03003962cdea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.5

Security for datasette-write 0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page