Integrating automated data quality rule discovery with an existing GX pipeline
By Sri Harsha Tanamala
Great Expectations (GX) provides a flexible framework for validating data, but defining and maintaining Expectations across hundreds of datasets can require considerable engineering effort.
What if the rules could be discovered automatically and then executed through an existing GX pipeline?
We explored this using the DataBuck SDK, which generates candidate data quality rules from datasets. Rather than replacing GX, the objective was to use DataBuck for rule discovery and GX for validation.
We tested two integration approaches on Databricks, comparing their correctness, execution performance, and compatibility with GX.
1. How the integration works
DataBuck SDK discovers candidate rules and exports them in JSON or YAML format. These include completeness, uniqueness, validity, and more complex SQL-based conditions.
The integration follows a straightforward workflow:
Dataset → DataBuck Rule Discovery → Rule Review → GX Validation → Quality Gate
Discovery and validation are separate activities. Rules can be discovered periodically, reviewed, and then executed through existing GX pipelines.
DataBuck SDK rule discovery
2. Two ways to execute DataBuck rules in GX
We evaluated two approaches.
Approach A: Native GX Expectations
The first approach translates discovered rules into standard GX Expectations wherever an exact mapping exists.
For example:
python
gx.expectations.ExpectColumnValuesToNotBeNull(
column=“customer_id”
)
Rules that cannot be translated exactly are executed using GX’s UnexpectedRowsExpectation with custom SQL.
In our test, 18 of 96 row-level rules mapped to native GX Expectations. The remaining 78 required custom SQL.
This approach produces more recognizable GX suites but introduces additional translation and execution overhead.
Approach B: Boolean-column validation
The second approach lets Spark evaluate the discovered rules and generates a Boolean column for each rule.
GX then checks whether every value in the corresponding column is True.
python
gx.expectations.ExpectColumnValuesToBeInSet(
column=“db_rule_0007”,
value_set=[True]
)
This approach preserves the original SQL rule logic without requiring translation into native GX Expectations.
The trade-off is that GX reports generic Boolean-column Expectations rather than the original rule types. Rule names and metadata must be retained for readability.
Complete integration code
3. Results from our Databricks PoC
We tested both approaches using the same dataset and discovered rules.
| Test configuration | Value |
|---|---|
| Dataset | 10,000 rows, 50 columns |
| Row-level rules | 96 |
| Dataset-level checks | 1 |
| Great Expectations | 1.24.1 |
| Spark | 4.0.0 |
| Databricks Runtime | 17.3 LTS ML |
Both implementations produced identical validation results.
| Metric | Native GX | Boolean columns |
|---|---|---|
| Median execution time | 87.6 sec | 52.9 sec |
| Passed checks | 72 | 72 |
| Failed checks | 25 | 25 |
| Execution errors | 0 | 0 |
| Quality-gate breaches | 8 | 8 |
The Boolean-column approach was approximately 40% faster in this experiment.
Each approach was run once for warm-up, followed by three timed runs. The results are specific to this dataset and environment; larger-scale performance remains to be tested.
4. Which approach should you choose?
Both approaches have practical advantages.
Native GX Expectations are preferable when teams want readable, reusable Expectation Suites and familiar GX reporting.
Boolean-column validation is useful when executing many complex SQL rules efficiently is more important than representing each rule as a native GX Expectation.
For our workload, we preferred the Boolean-column approach because it preserved the original rule semantics and delivered better execution performance.
One limitation is that the dataset-level check ran outside GX in the Boolean-column implementation and was included in the combined report.
5. Conclusion
Automated rule discovery and data quality validation do not necessarily need to be handled by the same tool.
Our experiment demonstrated that DataBuck SDK-generated rules can be executed through Great Expectations without replacing an existing GX pipeline.
Both integration approaches produced identical validation outcomes. The Boolean-column approach performed better in our test, while native GX translation offered more readable Expectations.
For teams already using GX, this provides another way to reduce manual rule creation while retaining their existing validation workflows.
Automated discovery still requires rule review. Generating a rule does not automatically make it suitable for production.
Source code and documentation
Rules: https://github.com/angsumandutta/databuck-gx-bridge/blob/main/Lending_Club_Loan_V63.json
Source code: https://github.com/angsumandutta/databuck-gx-bridge/blob/main/databuck_to_gx.ipynb
Repo link: https://github.com/angsumandutta/databuck-gx-bridge/tree/main
![]()
About the Author
Sri Harsha Tanamala
Sri Harsha Tanamala has over 5 years of experience in data quality automation and integration with modern data engineering frameworks.
Disclosure: This article describes an internal proof of concept involving the DataBuck SDK, developed by FirstEigen.



