Track changes to data using triggers and hidden JSON tables
Project description
datasette-sqlite-history-json
Track changes to data using triggers and hidden JSON tables using sqlite-history-json.
Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-sqlite-history-json
Usage
Install tracking on a table from Datasette's table actions menu (Enable tracking) or access the route directly:
/-/history-json/<database>/<table>/-/enable
Once enabled, the table action menu also shows:
View history→ table history page at/-/history-json/<database>/<table>Disable trackingif tracking is already active
On each row in a tracked table, the row action menu now shows:
View row history→/-/history-json/<database>/<table>/<primary-key>, with a subtitle showing the number of changes.- If the table is not tracked, or the user lacks permission, that action does not appear.
API
All endpoints return JSON for machine access and can be used in scripts:
- Table history:
/-/history-json/<database>/<table>.json - Row history:
/-/history-json/<database>/<table>/<primary-key>.json - Filter by operation:
?operation=insert|update|delete
Permissions
The plugin registers:
sqlite-history-jsonfor enabling/disabling tracking (database-level action)sqlite-history-json-viewfor viewing history (table-level action)
sqlite-history-json-view is automatically allowed in non---default-deny mode when the actor can view-table.
Required permissions by feature:
- Enable tracking:
sqlite-history-jsononDatabaseResource(database) - Disable tracking:
sqlite-history-jsononDatabaseResource(database) - View table history page/action:
sqlite-history-json-viewonTableResource(database, table)(plus the implicitview-tablecheck) - View row history action/page: same as table history permission above
In --default-deny mode, sqlite-history-json-view is not auto-granted. In that case, provide explicit grants for that action in your permission policy (and keep sqlite-history-json grants as needed for managing tracking).
Notes
<primary-key> is URL-safe, tilde-encoded values in the same format Datasette uses internally (for example comma-joined values for composite keys).
Development
To set up this plugin locally, first checkout the code. You can confirm it is available like this:
cd datasette-sqlite-history-json
# Confirm the plugin is visible
uv run datasette plugins
To run the tests:
uv run 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_sqlite_history_json-0.1a0.tar.gz.
File metadata
- Download URL: datasette_sqlite_history_json-0.1a0.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7bba6b30620c0079745e8fb546deaf83285eec167de19c9426b59378124513e
|
|
| MD5 |
1980b4e85d055c47636f294880940a0c
|
|
| BLAKE2b-256 |
afefde322d5902e7bebfc9906cd047005ff824c52177b5af5819f99b04a1512f
|
Provenance
The following attestation bundles were made for datasette_sqlite_history_json-0.1a0.tar.gz:
Publisher:
publish.yml on datasette/datasette-sqlite-history-json
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datasette_sqlite_history_json-0.1a0.tar.gz -
Subject digest:
a7bba6b30620c0079745e8fb546deaf83285eec167de19c9426b59378124513e - Sigstore transparency entry: 929130822
- Sigstore integration time:
-
Permalink:
datasette/datasette-sqlite-history-json@700b426bf096819c2dfca9841e253c63668be4aa -
Branch / Tag:
refs/tags/0.1a0 - Owner: https://github.com/datasette
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@700b426bf096819c2dfca9841e253c63668be4aa -
Trigger Event:
release
-
Statement type:
File details
Details for the file datasette_sqlite_history_json-0.1a0-py3-none-any.whl.
File metadata
- Download URL: datasette_sqlite_history_json-0.1a0-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cb46ff662ab14d5c4135634cc52f026f4a1d3b0ff116e2b8761c17ad54254ff
|
|
| MD5 |
3686e7c560da53eac297a3c5edcfd47b
|
|
| BLAKE2b-256 |
79d8216b4ca66795e33f9dde60b3f51187b345a31f4fa3d9f2512d1df23b15ae
|
Provenance
The following attestation bundles were made for datasette_sqlite_history_json-0.1a0-py3-none-any.whl:
Publisher:
publish.yml on datasette/datasette-sqlite-history-json
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datasette_sqlite_history_json-0.1a0-py3-none-any.whl -
Subject digest:
5cb46ff662ab14d5c4135634cc52f026f4a1d3b0ff116e2b8761c17ad54254ff - Sigstore transparency entry: 929130823
- Sigstore integration time:
-
Permalink:
datasette/datasette-sqlite-history-json@700b426bf096819c2dfca9841e253c63668be4aa -
Branch / Tag:
refs/tags/0.1a0 - Owner: https://github.com/datasette
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@700b426bf096819c2dfca9841e253c63668be4aa -
Trigger Event:
release
-
Statement type: