Skip to main content

VALVE bindings for Python

Project description

valve.py

VALVE bindings for Python

Install/setup from source

  1. Retrieve valve.py from GitHub:

     git clone git@github.com:ontodev/valve.py.git
     cd valve.py
     make test
    
  2. Activate the virtual environment:

     source valve.rs/.venv/bin/activate
    
  3. Add the statement

     import ontodev_valve
    

    to the top of your python script.

Usage examples

See the file test/main.py for usage examples.

API reference

valve(table_table, db_path, command, verbose, config_table="table")

Given a path to a configuration table (either a table.tsv file or a database containing a table named "table"), and a directory in which to find/create a database: configure the database using the configuration which can be looked up using the table table, and optionally create and/or load it according to the value of command (see Valve Command). If the verbose flag is set to true, output status messages while loading. If config_table (which defaults to "table") is given and table_table indicates a database, query the table called config_table for the table table information. Returns the configuration map as a String.

get_matching_values(config, db_path, table_name, column_name, matching_string)

Given a config map represented as a JSON string, a directory containing the database, the table name and column name from which to retrieve matching values, return a JSON array (represented as a string) of possible valid values for the given column which contain the matching string (optional) as a substring (or all of them if no matching string is given). The JSON array returned is formatted for Typeahead, i.e., it takes the form: [{"id": id, "label": label, "order": order}, ...].

validate_row(config, db_path, table_name, row, existing_row, row_number)

Given a config map represented as a JSON string, a directory in which to find the database, a table name, a row, and if the row already exists in the database, its associated row number (optional), perform both intra- and inter-row validation and return the validated row as a JSON string.

update_row(config, db_path, table_name, row, row_number)

Given a config map represented as a JSON string, a directory in which the database is located, a table name, a row represented as a JSON string, and its associated row number, update the row in the database.

insert_new_row(config, db_path, table_name, row)

Given a config map represented as a JSON string, a directory in which the database is located, a table name, and a row represented as a JSON string, insert the new row to the database.

ValveCommand

The following commands may be used with the valve() function.

ValveCommand.Config

Configure but do not create or load.

ValveCommand.Create

Configure and create but do not load.

ValveCommand.Load

Configure, create, and load.

Before creating a new release

Edit the file VALVE.VERSION and adjust the version of valve.py (and, if necessary, valve.rs). After pushing your commit, create a new release in GitHub with the new version number as the release name and tag.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

ontodev_valve-0.2.1-cp310-none-win_amd64.whl (3.1 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

ontodev_valve-0.2.1-cp310-cp310-musllinux_1_2_x86_64.whl (5.1 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

ontodev_valve-0.2.1-cp310-cp310-manylinux_2_31_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.31+ x86-64

ontodev_valve-0.2.1-cp310-cp310-macosx_11_0_arm64.whl (3.3 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

ontodev_valve-0.2.1-cp310-cp310-macosx_10_7_x86_64.whl (3.6 MB view hashes)

Uploaded CPython 3.10 macOS 10.7+ x86-64

ontodev_valve-0.2.1-cp39-none-win_amd64.whl (3.1 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

ontodev_valve-0.2.1-cp39-cp39-musllinux_1_2_x86_64.whl (5.1 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

ontodev_valve-0.2.1-cp39-cp39-manylinux_2_31_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.31+ x86-64

ontodev_valve-0.2.1-cp39-cp39-macosx_11_0_arm64.whl (3.3 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

ontodev_valve-0.2.1-cp39-cp39-macosx_10_7_x86_64.whl (3.6 MB view hashes)

Uploaded CPython 3.9 macOS 10.7+ x86-64

ontodev_valve-0.2.1-cp38-none-win_amd64.whl (3.1 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

ontodev_valve-0.2.1-cp38-cp38-musllinux_1_2_x86_64.whl (5.1 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ x86-64

ontodev_valve-0.2.1-cp38-cp38-manylinux_2_31_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.31+ x86-64

ontodev_valve-0.2.1-cp38-cp38-macosx_11_0_arm64.whl (3.3 MB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

ontodev_valve-0.2.1-cp38-cp38-macosx_10_7_x86_64.whl (3.6 MB view hashes)

Uploaded CPython 3.8 macOS 10.7+ x86-64

Supported by

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