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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

substrait_validator-0.1.1-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.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (5.8 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.1-cp311-none-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

substrait_validator-0.1.1-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.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (5.8 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.1-cp310-none-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

substrait_validator-0.1.1-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.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (5.8 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.1-cp39-none-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.9 Windows x86-64

substrait_validator-0.1.1-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.1-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.1-cp38-none-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.8 Windows x86-64

substrait_validator-0.1.1-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.1-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.1.tar.gz.

File metadata

File hashes

Hashes for substrait_validator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6c84cd20e384f666e0b653fdc24a4913bc69ef2fec8e6ef59b153ad786e13044
MD5 eb1ed2cadbbec8b5f32f6071088b867f
BLAKE2b-256 665b7946a721d0605b5c885da66dfcf7061a478d88329f7ed9151c5bc142156a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.1-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 65148da79ec477fc817ccead26e7c44ff5df30ec56e35d70fa154e4bd20f3da0
MD5 f59bb64e83b9809db70a8f92d282d8e6
BLAKE2b-256 dc4192474992f34f17cdd710e86eb19774f9854ec4529b0edf5c9a76a5e8f135

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e20db90ff9b8667bbed84ef7f3aa9c9532ac0db704f4ea3352ef2ae307af1b5
MD5 4302cf9717acb672a0fd8ddd769df744
BLAKE2b-256 0258d799faf34a03522f21ff1f5552cd6825e30374ccf4dbeb0dd28e8288a10d

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.1-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.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b2c2c7d74494f8d5ab8d23541759d7c9a99a2404deedac14b411ad95afd7e0cd
MD5 c17a535195fc70424697cb12f14063de
BLAKE2b-256 bc2a82c1999fb9d99d70a466f3eee14fedb353b06805d1f9febcdff37cfb3490

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.1-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 94209b8482ea4b197ade5eb3962cf8f776ff5145e8c973280977eff895feb385
MD5 70ed96bde8ecfb90f8aecc1c70833761
BLAKE2b-256 96c32bdf9641ab3c23d8f836f0f218f3b6792afcd1fef7254f3a75e1b1437cff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 44e604bd8991debe674ab8401c32c79dba27710a92af8ae854aeb8a8422ce6e8
MD5 375896efef20097342197dde277991bf
BLAKE2b-256 118449d951a921ec96f89b6a213630588e65f72cc39af5024bdf77448ce87430

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.1-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.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b784f24f11e1d42750007d9dbe695f01fb34c8876889e5a01ab2863d2c0f3e61
MD5 edfa65d44901c3cb5918c3ca8e536106
BLAKE2b-256 9a6a0a8239a236ed54aba052b4459f9b58aa17a5134bd4dcd2885542cf4154f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.1-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 d3e9e8801f14173b890bbcd4ef4b009f39de2a56c9b0df27ceafdbb55f4ca448
MD5 1a9aac38878ed7ee35133f10e708b7c6
BLAKE2b-256 512a1987d7eaf9c1aee7387c7d7e98023b484d073c8d10ac05469786aebc96cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 03ba400215bb2f978ecefac84d1cfc037acddd041d169a32b0c9c881ba1df4af
MD5 d86093a7fd29d0f936ec842bd5f119ae
BLAKE2b-256 b5a1f5dfb7c3c20f01bfe18c3bacf968b77ef483606a0c49cb167f793ab6b8e1

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.1-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.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 7ea8af9099e664fc335283e88bf09b95b4b3b2dbe9c11f5f1fecfb43f60ca7ad
MD5 e498fedda85e7477a56b873a40bd5899
BLAKE2b-256 0615438d1d8153c8a1733d905fad9df24247377f1e79f83aca755a3a14363c14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.1-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 f5de5da9653f58b6247a4d7a9a71d1035ee96b90f2fc64c896dbccc8f03772e9
MD5 6edb76f50c4213fdc711278e808670f3
BLAKE2b-256 a9a9819fffa5ec5f7856abc4d49970b996a6500d20ad24ad59c3360b545097d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3e429aa81d820b233b14b4608b448bf63369830dce294b99a145dfbd97095685
MD5 61971eeb7a35b0a535e8e4f1fb8fc511
BLAKE2b-256 449b7fdebd76bbf0f246c5234cdf7ad896e6809b76a4fc5f9db898c7abe9093c

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.1-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.1-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 8323bc368fa36f4da7c446c78404a19920152aef755d0ddb15947a4f680c4a56
MD5 dc131f7d02986ac7d86c0dccde60bfdc
BLAKE2b-256 d06eeb86f478be8771bf07c3af5e308b554444d3d79ec4d41f3741b55918b351

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.1-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 0a8a39e35944cd006ed2eae12cefaf1dc2643dc550e8b5fe2d4c8bf2dab5c6b7
MD5 9dac0c222635f51386996d28c0b41694
BLAKE2b-256 92960e1e24ac2f4b1cbcba68b63ede09fe817b952205aa79f9b438df6d4cafc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for substrait_validator-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2acb4470dbfc5485aa92e620e18d79796e48a5476dafc7247329fc642c323dec
MD5 180b6217ecd7e8b32ce2d3b9048a6588
BLAKE2b-256 de8fa2ac55c30c5089fb189e4f051164136de568d46d959d49e2064e27e0a350

See more details on using hashes here.

File details

Details for the file substrait_validator-0.1.1-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.1-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 ff56a65c2c067963a9b1e0994368f3c23a918c1acc31366a0be5b09c83d691c2
MD5 e6b918fd8dd3f886177d3af61f3a5e5f
BLAKE2b-256 348c200c4d7f847dd8fced22048cc0ee3f69ecec49e81d2e27d01b2e6ea7b1bd

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page