Skip to main content

Enrich data with a custom JavaScript function

Project description

datasette-enrichments-quickjs

PyPI Changelog Tests License

Datasette enrichment for enriching data with a custom JavaScript function

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-enrichments-quickjs

Usage

This enrichment allows you to select rows from a table and specify a custom JavaScript function to use to generate a value for each of those rows, storing that value in a specified column and creating that column if it does not exist.

Code runs in a QuickJS sandbox with a 0.1s time limit for the execution of each function and a 4MB memory limit.

Enrichment JavaScript functions look like this:

function enrich(row) {
    return row["title"] + "!";
}

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-enrichments-quickjs
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datasette-enrichments-quickjs-0.1a1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file datasette-enrichments-quickjs-0.1a1.tar.gz.

File metadata

File hashes

Hashes for datasette-enrichments-quickjs-0.1a1.tar.gz
Algorithm Hash digest
SHA256 5b0198f6ac4fe7c0395dc84e3f9ea5b7fed3cc10b210fd54fc8fc7fa2b5ed816
MD5 5a0b7baaf695da50665ae3fc5fe3e609
BLAKE2b-256 4444a3fbde06de31ee7331ac1b83c166b93c2e807e4b8036a49b1c9fd2db8dc2

See more details on using hashes here.

File details

Details for the file datasette_enrichments_quickjs-0.1a1-py3-none-any.whl.

File metadata

File hashes

Hashes for datasette_enrichments_quickjs-0.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 c0d62c1061e81e76b45bf305385da6a9f2a399143cba0356f3fd48fc3a1c000a
MD5 78478f03bf8923544879c02df065597d
BLAKE2b-256 bc8cc335df9430555b3d17b4ffe76600570c09b4e61bccfaaca9a039983be90a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page