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.3.tar.gz (462.2 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

substrait_validator-0.1.3-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (5.9 MB view details)

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

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

substrait_validator-0.1.3-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (5.9 MB view details)

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

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

substrait_validator-0.1.3-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (5.9 MB view details)

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

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

substrait_validator-0.1.3-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (5.9 MB view details)

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

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

substrait_validator-0.1.3-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (5.9 MB view details)

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

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.3.tar.gz
Algorithm Hash digest
SHA256 04bc053bfa4e6add72ed12f8d4ddd6db8154556e3520d950574946bcfd946394
MD5 bcf88affbd0653802b8ddd7c1c7cd4aa
BLAKE2b-256 a9c5f3ea278cfe62f45ef0b9768d1e5eb68ea55127f01f877bf3b4ffd1651dfb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 71503ed4eeaa087ab6a02de6109ff4b57aa39c37e5aff2203ccbdfc3e841b4cc
MD5 8124677b827589e2f0dc22d3f1236c58
BLAKE2b-256 28fe5cb3cecd29ebe825c00debf69e4d3620b2e1ef389b98abde0470ac42b067

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 860cb9c6503b1e14f53d28b44e3cdd5544c6e5b0b325942f5e5472c416116a6e
MD5 c2abedc7ed1c5b2a47953b274c3677e3
BLAKE2b-256 6c3d4f3f4e468fe7992005bb3fba368385063cb678ce874a4a4dc65ab1cdac01

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.3-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 96ea3bbdcb0a2b19accf941d6b0122d972d60b7588b2b30ce3b8d29c222848a6
MD5 3d4cbba4deb8454bdb105fadf58a8853
BLAKE2b-256 31781f269ad7a6abdec8d490c7792d385a9d058b8490bb2bfaee2bff180b174d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 cb40ecbfb2465809408dcbd8080ddc19a1896ec61e81fadf15e0e771a13fc6bd
MD5 f8305b87816192a58c37fadc94a2e6b6
BLAKE2b-256 d2d6458b2a769efb6ffc987d8979d2f7a88489696b02e2a735f7ff574f5e58ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 006260ea8d302fd8071837e76380815c0ab9a7de256cbda72caef74ca3a25905
MD5 9e68de34324e155397cfb0c218892f92
BLAKE2b-256 c92c72fefe30bcec63d5c6f17cec024428f1550f2bff9587a75f23bbd1e4a12c

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.3-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 eaaea7ffa23adff6c3b538f738cc92617b9ef1e9f2d5f99e4d16a39ced57116c
MD5 ada5f5fdbd40a2704b1cfeca8cab8bc6
BLAKE2b-256 4b44a10beb519520649338fb838a0aab730adea524262f56eb7b0453369c5f0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 dc8a6469333681c261107b2357863ca55378a7e5e73b6d0d8d6a2eba9d34affb
MD5 f1fde1069f61461b500e49a65b2fc568
BLAKE2b-256 84d7e788a75bb8bb9cec9bf7e36331ea69cbcbe1ba125141d1df3e6524b9e2f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2a15383cdfcf1afdd4f60e3b330c84b79465da05df1e71fa22e20f60914d8814
MD5 bc088d155e9a557705f9fa57eff9ce31
BLAKE2b-256 a78903867d63b8f00ae520df688227a3def030ce7ecc169ffc8f1671ed18aef7

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.3-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 21edeed6f6b3f7071c557b99ef0b8604c07f759a75766abc7f40f6e264dd4579
MD5 cf360a7c2c1d4b30b76310765fcf1d58
BLAKE2b-256 6dec2946f011e1df3daeba94c2403a9b448fa34bbe6121f0328c4531966a8023

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 ca621fb5dfc2b0e9ae93c0537470cc0f2a0d1f24a90cbf361026d41b93357b98
MD5 c953f6a04c4a2beccac47262790551e2
BLAKE2b-256 d1c6f4b80e06177ab29443c935d0470bc373a2da72feaa9904e003bab41578bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bfe0d7aa62089b0496fea42f18b82e80550e890568d3dc916fc5fd09f8337957
MD5 f2b2e3f860bbbfb306c513c39f04b62c
BLAKE2b-256 d06393287a54d024e617223033d00bc140d4c5fc0bbce98e0240ffd2d13344b1

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.3-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 dffd015f14c2a9f7529415811e66c3d859973570e490a58ac27e120fa60dd56f
MD5 2cd8979168a1708e857cb32c81a7efed
BLAKE2b-256 cc9ea1b812eb424eb94b54c63ac119f662bc9a1d959712a695eac24ce1e0b65d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 6e76ad5b32d29a0eb03d35fc822a2bbbda43e46381dfb50b5b3e93fe6e63d3ec
MD5 9a2a85c7544de96ba392560b8459bb05
BLAKE2b-256 9c2e0b1d357730969fb255f48d1d8e37a54753bb57a6007a3e7f27ee7418fa90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ed74a73bb72d99ab39d4df5091a27e2b96cefb20b36b5d773116ed20f36e3165
MD5 4d9f8b59b26c35f66e301ab161b2126d
BLAKE2b-256 49cda1238049c0a69513964a51056dde99b998dd933b9446cbf562dfb196d010

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.3-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for substrait_validator-0.1.3-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 7b61720140086f14a31c9e7f2656c7800237d1d3aa6e2d6caba7dc64191bcdb6
MD5 e332a585f1ae59221f35b99c96b0eb8a
BLAKE2b-256 2a02b308132942fe3eb41611026fb7315aad3a0af5d067087814e2c0216cb335

See more details on using hashes here.

Supported by

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