datafusion-query-builder
Programmatic, injection-safe builder for DataFusion SQL.
Decision gist · record as of 2026-08-14
Yes, if you build DataFusion queries from user input or dynamic parameters. The injection-safe-by-construction design and readable SQL output make it worth the medium install friction. Alpha status and 26-day-old release suggest active development; verify dialect coverage for your specific query patterns before production use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; prebuilt wheels available for common platforms (macOS arm64/x86_64, Linux x86_64/aarch64).
- Medium install friction due to compiled Rust wheels; prebuilt abi3 wheels available for CPython 3.9+ on macOS (both architectures) and Linux (x86_64 and aarch64).
- Active maintenance with a release 26 days ago.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
last release 2026-07-19 (26 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 104,416 downloads/mo, #12,749 on PyPI
Alternatives
Verify before relying
from datafusion_query_builder import col, table, functions as f
q = table("records").filter(col("kind") == "span").select(
f.coalesce(col("service_name"), "(unknown)").alias("service")
).limit(200)
print(q.to_sql())- Whether the library's DataFusion SQL dialect coverage matches your specific query patterns.
- Performance characteristics when building very large or deeply nested queries.
- Stability guarantees given the Alpha development status.
What it is and what it does
datafusion-query-builder is a typed SQL query builder for DataFusion, written in Rust with a Python API exposed via PyO3. It replaces hand-rolled SQL strings with a composable, type-safe interface that automatically escapes values by construction—untrusted input like column values or user-supplied filters are safe to embed without manual quoting. The builder emits actual SQL text (not an AST or opaque object), so queries remain visible in logs, greppable, and cache-keyable.
The library provides a façade layer over sqlparser, handling expressions, filters, selections, grouping, and ordering through method chaining. Python scalars auto-promote to literals; specialized operators like JSONB key-exists checks (`has_key`, `has_any_key`, `has_all_keys`) are first-class. An explicit `raw()` escape hatch and `param()` placeholders allow stepping outside the standard grammar when needed. The crate is correctness-critical and tested against DataFusion itself as an oracle to catch silent encoding errors.
Use it for
- Build dynamic SQL filters from user input without manual escaping or string concatenation.
- Generate analytics queries programmatically while keeping SQL visible in application logs.
- Construct complex DataFusion queries with type safety and composable method chaining.
- Embed untrusted column names or filter values safely without SQL injection risk.
- Test query generation logic with deterministic, re-parseable SQL output.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you build DataFusion queries from user input or dynamic parameters.
The injection-safe-by-construction design and readable SQL output make it worth the medium install friction. Alpha status and 26-day-old release suggest active development; verify dialect coverage for your specific query patterns before production use.
Install
datafusion-query-builder on PyPI
Before you install
Medium install friction due to compiled Rust wheels; prebuilt abi3 wheels available for CPython 3.9+ on macOS (both architectures) and Linux (x86_64 and aarch64). Active maintenance with a release 26 days ago.
Requires Python 3.9 or later; prebuilt wheels available for common platforms (macOS arm64/x86_64, Linux x86_64/aarch64).
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
from datafusion_query_builder import col, table, functions as f
q = table("records").filter(col("kind") == "span").select(
f.coalesce(col("service_name"), "(unknown)").alias("service")
).limit(200)
print(q.to_sql())
Verify before relying
- Whether the library's DataFusion SQL dialect coverage matches your specific query patterns.
- Performance characteristics when building very large or deeply nested queries.
- Stability guarantees given the Alpha development status.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 26 days since the last release |
| First released | |
| Downloads | 104,416 / month, #12,749 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3 :: OnlyProgramming Language :: RustTopic :: DatabaseTyping :: Typed |
Evidence: datafusion_query_builder-0.2.0-cp39-abi3-macosx_11_0_arm64.whl; datafusion_query_builder-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; datafusion_query_builder-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “datafusion query construction”
- datafusion-query-builderBuilds DataFusion SQL queries programmatically with injection-safe…
- datafusionDataFusion is a Python binding to Apache Arrow's in-memory query…
- substraitProvides a Python interface to construct, manipulate, and serialize…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also datafusion · sqlfluffrs · buildpg · django-query-builder · ibis-framework · SQLAlchemy · syntaqlite · apache-airflow-providers-common-sql · sqloxide · PyPika