datasette-enrichments-shell
Something I've always wanted to do is to be able to easily run a map reduce operation on a CSV. This is something that all the nifty command line tools (zq, jq, etc) don't allow you to do.
However, I noticed that Datasette recently added the ability to write enrichment plugins. I hacked together this enrichment plugin that allows you to run an arbitrary shell script and if the script was successful, save the resulting output to a new column.
Installation
Install this plugin in the same environment as Datasette.
datasette install -U datasette-enrichments-shell
Or, if you are hacking on this locally:
datasette install -U ~/Projects/python/datasette-enrichments-shell
Usage
After installing the plugin, you'll see the shell enrichment option in the UI. You can use this to run a shell command and save the output to a new column.
Examples
Here's how to test a shell script before plugging it into the web UI:
echo '{"rowid": 1, "firstName": "Forest", "lastName": "Tree"}' | \
jq -r '"-p firstName \(.firstName) -p lastName \(.lastName)"' | \
xargs -I {} /Users/mike/.asdf/shims/sqlite-utils query email_personal.db "SELECT * FROM address_book WHERE first_name = :firstName AND last_name = :lastName LIMIT 1" {}
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-enrichments-shell
poetry install
Metadata
Release files for datasette-enrichments-shell 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| datasette_enrichments_shell-0.3.0.tar.gz | 4.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datasette_enrichments_shell-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.0 kB
Release files / datasette_enrichments_shell-0.3.0.tar.gz
| Download URL | datasette_enrichments_shell-0.3.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0b175c2962c358ab8fbdb27c24b9e575cd6e43bbdefafb91fddbb4f6d3d0219
|
|
BLAKE2b-256 checksum How to use checksums |
240ebbe7eb305b1830b61b09d40abd7867a8b5fb988a3d5249e0240819f5ec8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1024-azure
|
Release files / datasette_enrichments_shell-0.3.0-py3-none-any.whl
| Download URL | datasette_enrichments_shell-0.3.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c113d25be7447e74db419301d7fc7b4635818c5e190b404db9af2aa88e648b6
|
|
BLAKE2b-256 checksum How to use checksums |
e08241b9e339542cb36425ab265a741bde83ece3a3d88d51bd06da67b1bca523
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1024-azure
|
Security for datasette-enrichments-shell 0.3.0
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.