substrait
A python package for Substrait.
What it is and what it does
Substrait is a Python binding for the Substrait specification, a cross-language standard for representing data compute operations. It lets you build query plans programmatically in Python and serialize them for execution by Substrait-compatible engines like DuckDB or DataFusion. The package offers two main APIs: a high-level DataFrame interface (similar to Polars or PySpark) for ergonomic plan authoring, and lower-level proto and builder layers for fine-grained control. Plans can be constructed from scratch, parsed from binary or JSON representations, or consumed from other Substrait producers like Ibis.
The package is experimental and actively developed. It depends on protobuf for serialization and substrait-protobuf for the core message definitions. It is not an execution engine itself—it is purely a plan builder and consumer. The DataFrame API is the recommended approach for hand-authored plans, while the proto layer provides direct access to the underlying Substrait message types for advanced use cases.
Use it for:
- Build query plans in Python and pass them to DuckDB or DataFusion for execution.
- Parse and inspect Substrait plans received from other producers like Ibis.
- Serialize plans to binary or JSON for transmission or storage across language boundaries.
- Construct complex data operations programmatically using the fluent DataFrame API.
- Integrate Substrait plan generation into Python data pipelines or query optimization tools.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a Python interface to construct, manipulate, and serialize Substrait Plans—cross-language specifications for data compute operations—for consumption by engines like DuckDB or DataFusion.
Yes, if you need to generate or consume Substrait plans in Python. Low install friction, active maintenance, no known vulnerabilities, and permissive licensing make it safe to adopt. The DataFrame API is approachable for typical use cases. Not suitable if you need plan execution—use it only as a builder for engines that consume Substrait.
Install
substrait on PyPI
pip
pip install substraituv
uv add substraitpoetry
poetry add substraitInstalling substrait
Before you install
Low install friction; pure Python wheel with three runtime dependencies (protobuf, substrait-protobuf, substrait-extensions). Package is actively maintained with a release 16 days old.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install substrait
import substrait.dataframe as sub
plan = (
sub.read_named_table("people", {"id": sub.i64, "age": sub.i64})
.filter(sub.col("age") > 25)
.to_plan()
)
serialized = plan.SerializeToString()
Requires Python 3.10 or later (and less than 3.15). For function overload resolution, install the extensions extra: pip install "substrait[extensions]".
Verify before relying
- Whether the DataFrame API fully covers all Substrait specification features or if some plans require the lower-level proto/builders API.
- Performance characteristics when building or serializing large or deeply nested plans.
- Compatibility guarantees with specific versions of DuckDB, DataFusion, or other Substrait consumers.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<3.15,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — protobuf, substrait-protobuf, substrait-extensions |
| Maintenance | actively maintained — 16 days since the last release |
| First released | |
| Downloads | 326,474/month — #7,575 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: substrait-0.30.0-py3-none-any.whl
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
substrait-protobufProvides Python protobuf bindings for the…
permissive · top 15,000 on PyPI
ibis-frameworkIbis is a portable Python dataframe library…
permissive · top 5,000 on PyPI
dltdlt automates extraction, schema inference, and…
permissive · top 5,000 on PyPI
datafusionDataFusion is a Python binding to Apache…
permissive · top 5,000 on PyPI
duckdb-extension-httpfsEnables DuckDB to query data over HTTP/HTTPS by…
permissive · top 15,000 on PyPI
dask-exprDask Expressions provides query optimization…
permissive · top 5,000 on PyPI
fugueFugue provides a unified Python interface to…
permissive · top 5,000 on PyPI
sqlglotrsA SQL parser, transpiler, and optimizer that…
permissive · top 5,000 on PyPI
constructConstruct is a declarative parser and builder…
permissive · top 5,000 on PyPI
sqlglotSQLGlot parses, transpiles, optimizes, and…
permissive · top 1,000 on PyPI