Skip to main content

Validator for Substrait query plans

Project description

Python bindings for validator

This directory contains a Rust/PyO3 project to generate Python bindings for the validator library.

Installation

The easiest way to install the validator is to get it from PyPI:

user@host:~$ pip install substrait-validator

If you want to build manually, running something along the lines of pip install . should work. You should only need to have a rust compiler installed.

If you want to create wheels or sdists of your own, you can do so using maturin (note the manual prepare_build.py invocation, see hints):

user@host:~$ pip install "maturin>=0.14,<0.15"
...
user@host:~$ ./prepare_build.py populate
user@host:~$ maturin build
...
📦 Built wheel for CPython 3.x to /path/to/substrait-validator/target/wheels/substrait_validator-x.y.z-cp3xx-cp3xx-linux_x86_64.whl
user@host:~$ maturin sdist
...
📦 Built source distribution to /path/to/substrait-validator/target/wheels/substrait_validator-x.y.z.tar.gz

Some hints if you run into issues:

  • This project relies on submodules, so you need to check those out first.
  • Out-of-tree builds are not supported, so you may need to beat pip into submission if you're using an old version or it otherwise insists on building from a temp directory.
  • If you get weird errors, try running ./prepare_build.py populate manually first. The protobuf generation logic has to be run very early in the build process, and while this is done automatically for most build methods, not all methods provide a hook for this.

Building wheels and source distributions

You can build wheels and source distributions using maturin, specifically using the build and sdist commands. However, before you can do this, you must run ./prepare_build.py populate. This makes local copies of some files in the repository that live outside of this subdirectory, such as the protobuf description files. When you use pip or some other tool based on pyproject.toml, this will be done automatically via build system hooks, but unfortunately maturin doesn't itself provide hooks with which this can be automated.

Running tests

You can test the module using pytest after you install it.

Command-line usage

The module exposes a command-line program named substrait-validator for running the validator manually. You can also use the tool to convert between various serialization formats of the substrait.Plan message. Run substrait-validator --help for more information.

Library usage

The library essentially provides a bunch of type conversion functions at module scope to convert between the various representations of a Substrait plan, including the result of the validator. The most important functions are arguably check_plan_valid(plan, config=None) and check_plan_not_invalid(plan, config=None), which run validation on the given plan and throw a Python exception corresponding to the first diagnostic returned by the validator of the highest severity encountered if the plan is not strictly or loosely valid respectively. That is, check_plan_valid will throw an exception if the plan could not be proven to be valid, while check_plan_not_invalid will only throw if it could be proven to be invalid.

The plan argument can be a number of things:

  • bytes: treated as a binary serialization of substrait.Plan.
  • str: treated as a protobuf JSON serialization of substrait.Plan.
  • dict: treated as the above using Python's data model (JSON objects map to dicts, JSON arrays map to lists).
  • substrait_validator.substrait.Plan: a previously deserialized plan.
  • substrait_validator.ResultHandle: a previously validated plan.

config can be None/unspecified, or can be set to a substrait_validator.Config object to configure the validator with.

For more information, use Python's help() function.

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

substrait_validator-0.1.4.tar.gz (462.8 kB view details)

Uploaded Source

Built Distributions

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

substrait_validator-0.1.4-cp312-none-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

substrait_validator-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

substrait_validator-0.1.4-cp312-cp312-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (6.0 MB view details)

Uploaded CPython 3.12macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

substrait_validator-0.1.4-cp311-none-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

substrait_validator-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

substrait_validator-0.1.4-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (6.0 MB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

substrait_validator-0.1.4-cp310-none-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

substrait_validator-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

substrait_validator-0.1.4-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (6.0 MB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

substrait_validator-0.1.4-cp39-none-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.9Windows x86-64

substrait_validator-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

substrait_validator-0.1.4-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (5.9 MB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

substrait_validator-0.1.4-cp38-none-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.8Windows x86-64

substrait_validator-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

substrait_validator-0.1.4-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (6.0 MB view details)

Uploaded CPython 3.8macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

File details

Details for the file substrait_validator-0.1.4.tar.gz.

File metadata

  • Download URL: substrait_validator-0.1.4.tar.gz
  • Upload date:
  • Size: 462.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.7

File hashes

Hashes for substrait_validator-0.1.4.tar.gz
Algorithm Hash digest
SHA256 928f2056fb0d9ad1a81d91ca4f2d1f619154ce768df3f295e1a845cda81b797f
MD5 ca1491ac75759226a024841c19bbbc42
BLAKE2b-256 0dc9dad85fa1dd13a85d0d474b4c82da20990944a2f0563bbcaa868d7bf49846

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 f686a51c747789c57b95042a5d53f0ef0a6616169a9e0b9b69161b5c1bb5c5d4
MD5 2ba4e7bc3da9a80d5847233eb9fcaede
BLAKE2b-256 b22ecf4587402541d7ce0926f3924ebd750eb6f7640a39a90d1ab4a5d52ce248

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e981e1c5239f17efea3c2726002e1f7a29b83e93a550660be2676d032f6c9c69
MD5 a2a8393ca5c3c3a32d19942ab81cc78a
BLAKE2b-256 e3ddfb992356942255a9816e11a364ec4242a5d6345539925e6c72297808398f

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp312-cp312-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp312-cp312-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b71da3be6702d148e4a6ac538772617346971fe2e687a226e9da68dca45a29b3
MD5 ecfd1d26abc37d43998ceb8954b06985
BLAKE2b-256 2030fb38e84ed8e1ea706be36c504e25cd8b47048a05ca933b466d21753fe452

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 1555e27417126513b54347b4fb0ae7971e6bdfe85725ff37e27577fe0f4fa1a0
MD5 8273479248c60eb9314a6757f0799ec9
BLAKE2b-256 426d855daf8448ac56e77592308a50de6544b22417d7ff9e889df742cf7c23a6

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e0e67e4eb3852dee47cef30a63339a2f64df57b1fa853aae94492f8895656f3a
MD5 bc48d8fe08a4e2d9150b2a968ef95951
BLAKE2b-256 f99623b68e1596cd43a2b42a65b1b2944892e09100e3bba6785a423fcd1bad78

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ea4d0b620b1125c9d514de16a5cbc40133fa6c1084e00018823e8eebab2d29ee
MD5 88ea346c6ed94c208d114e39479a76d1
BLAKE2b-256 44fd68cca2167894f670fc3bac903762e36ca934acfd90cd73afa4aeaeb0a8eb

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 df84edbe9c1b26db5bfbf25fbc9b12e43e3f850f0cdfc5a852d6fc2a3d4ae774
MD5 f55d535f37f12b0ad0e78ed7ebe8976b
BLAKE2b-256 00f7e1afa9e4915d27a2d1c586f439dd17f0cab0fa80f53991c3fd26e2b2050e

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cc2d1eebd16c96d485f715d45c926bfccd8d3dec340191103dfcea6da8f44c93
MD5 d1b0bff420382483f26ced2e563ed39a
BLAKE2b-256 67de033f342fef66896193760aebdabb035557eca0b383fb6a0801229346307d

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 f06daa8e7b71bf1e307465a602f13249400bba394799bc5e565b832f283ab816
MD5 8c3963d53a4d90caca1d9fddf81f312f
BLAKE2b-256 8cbc8ac89ef35d86e67b1622966772f8fd03c62a229261a813ef4416581a6e53

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 20fceb72bc4779ec584a33025ccae24ef73aae0cfef86f640b425ddd8167d75d
MD5 be194130ab5164644cd769685a1d4b1b
BLAKE2b-256 af5f68edf547d6b90d4ec6099f284a78b7ff53e283497f20b051eb8eead64922

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a4048a9d9de926ea9d0c011cdd672b168cf902a0fc85b79af1b27fc0c4a79404
MD5 7cc660dd43aee2e890d02806a4cffc1e
BLAKE2b-256 70a32e452df52e513932af46221d6b24ea1c1a4c63fdd653b15b23c85d3be790

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c6ed98cac87995d94a0e93122e9c157c19fd479ca792539f8fa96cddae168387
MD5 1e19e9087e14f2695dcc9d95ae634e20
BLAKE2b-256 cfcdeacb18042403e1d363d2968c1f2126f7a57e91770c6f26298503170344bb

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp38-none-win_amd64.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 49bf1aa8e781ab197ff9b3dda07fbe4d7e0e9310e349c82dd29aac9aeb943356
MD5 a91025ce4a0b66a5c0ff0c878d8a35f8
BLAKE2b-256 94a6016d96b75bd0b123919408dc195b09fe2a920e3cc47559ed8b3b052f07da

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a349e532601e7f2657a960603800cfa5ea8a754f36f95417f2deafefebd79bfa
MD5 d25436c1f8a51a9537a37aaab1f8a3ec
BLAKE2b-256 31a951a854b66619aa1f03c64a424af1acb6269671cabda1265b3b97178b6221

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.4-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.4-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ca5cbb1112b478842b8e48e31b7700d296caba864857bf5d149da6f2fbfc41bb
MD5 cebd436638c84858febd09404d593880
BLAKE2b-256 ff6f17f40eff277fc9dd3adeac060acea176fe1ef96de23a099d811548eaef60

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