A declarative PySpark framework for row- and aggregate-level data quality validation.
Project description
SparkDQ — Data Quality Validation for Apache Spark
SparkDQ is a lightweight data quality framework built natively for PySpark — no JVM bridge like PyDeequ, no complexity overhead like Great Expectations, and no platform lock-in like Databricks dqx. Define checks declaratively via YAML/JSON or through a type-safe Python API, validate at row and aggregate level in a single pass, and extend the framework via a plugin system without touching the core.
One dependency. No wrappers. No bloat.
Quickstart
Declarative — checks are passed as dicts, loaded from anywhere: YAML files, JSON, databases, or APIs:
from pyspark.sql import SparkSession
from sparkdq.engine import BatchDQEngine
from sparkdq.management import CheckSet
spark = SparkSession.builder.getOrCreate()
df = spark.createDataFrame(
[
{"id": 1, "name": "Alice"},
{"id": 2, "name": None},
{"id": 3, "name": "Bob"},
]
)
check_set = CheckSet()
check_set.add_checks_from_dicts([
{"check": "null-check", "check-id": "no-null-name", "columns": ["name"]},
])
result = BatchDQEngine(check_set).run_batch(df)
print(result.summary())
# Validation Summary (2024-01-01 00:00:00)
# Total records: 3
# Passed records: 2
# Failed records: 1
# Warnings: 0
# Pass rate: 67.00%
Python-native — full type safety and IDE autocompletion:
from pyspark.sql import SparkSession
from sparkdq.checks import NullCheckConfig
from sparkdq.core import Severity
from sparkdq.engine import BatchDQEngine
from sparkdq.management import CheckSet
spark = SparkSession.builder.getOrCreate()
df = spark.createDataFrame(
[
{"id": 1, "name": "Alice"},
{"id": 2, "name": None},
{"id": 3, "name": "Bob"},
]
)
check_set = (
CheckSet()
.add_check(NullCheckConfig(check_id="no-null-name", columns=["name"], severity=Severity.CRITICAL))
)
result = BatchDQEngine(check_set).run_batch(df)
print(result.summary())
# Validation Summary (2024-01-01 00:00:00)
# Total records: 3
# Passed records: 2
# Failed records: 1
# Warnings: 0
# Pass rate: 67.00%
SparkDQ ships with 30+ built-in checks across null validation, numeric ranges, string patterns, date boundaries, schema enforcement, uniqueness, and referential integrity.
🚀 See the official documentation to learn more.
Installation
For Local Development / Standalone Clusters
Install with PySpark included:
pip install sparkdq[spark]
For Databricks / Managed Platforms
Install without PySpark (runtime provided by platform):
pip install sparkdq
The framework supports Python 3.11+ and is fully tested with PySpark 3.5.x. SparkDQ will automatically check for PySpark availability on import and provide clear error messages if PySpark is missing in your environment.
Why SparkDQ?
-
Extensible by design: Add custom checks via a simple plugin system — no changes to the core required
-
Declarative or Pythonic: YAML/JSON configs or type-safe Python — your choice
-
Severity-aware: Distinguish between hard failures (CRITICAL) and soft constraints (WARNING)
-
Row-level and aggregate: Validate individual records and entire datasets in a single pass
-
Minimal footprint: Only Pydantic required — PySpark is provided by your platform
Let’s Build Better Data Together
⭐️ Found this useful? Give it a star and help spread the word!
📣 Questions, feedback, or ideas? Open an issue or discussion — we’d love to hear from you.
🤝 Want to contribute? Check out CONTRIBUTING.md to get started.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sparkdq-0.12.0.tar.gz.
File metadata
- Download URL: sparkdq-0.12.0.tar.gz
- Upload date:
- Size: 250.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f64f61c501d80f7ab4d2c9083795bd2287066e8ec9a610d97c17a3916a744a51
|
|
| MD5 |
b1a8f763ad935a9933f3e23c1b4e8a2b
|
|
| BLAKE2b-256 |
11e5d296ebd8b9239d3ba1eb70eafcc302c4603fca5d329e82e07bfd44b6a2d2
|
File details
Details for the file sparkdq-0.12.0-py3-none-any.whl.
File metadata
- Download URL: sparkdq-0.12.0-py3-none-any.whl
- Upload date:
- Size: 95.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a76b470e176ea2a45f5571cc720c5f14b669bf823eeeedd24c1f63eb236cd261
|
|
| MD5 |
b96f4a7f4104ac2123694d6d2ccd1d73
|
|
| BLAKE2b-256 |
21805044e5e42447a36cea321460464cec2ff71af446adf1fa84b8651df36596
|