feat: Great Expectations Exporter v2.0 - Enhanced Semantic Naming & Deduplication - #1544
Open
julienguilhempartner-spec wants to merge 13 commits into
Open
feat: Great Expectations Exporter v2.0 - Enhanced Semantic Naming & Deduplication#1544julienguilhempartner-spec wants to merge 13 commits into
julienguilhempartner-spec wants to merge 13 commits into
Conversation
…duplication - Remove expect_table_columns_to_match_ordered_list from all exports - Enrich expect_column_values_to_be_of_type metadata with expectation_id, name, description, dimension - Implement intelligent deduplication: skip required/unique when primaryKey=true - Humanize expectation names using businessName or column name fallback - Standardize expectation_id in snake_case format based on human-readable names - Support all major logicalTypeOptions (minLength, maximum, pattern, format, enum) Testing: - 31 tests all passing ✅ - Ruff linting: zero errors ✅ - Complete coverage for all engines (Spark, Pandas, SQL, Trino) Files modified: - datacontract/export/great_expectations_exporter.py - tests/test_export_great_expectations.py - tests/fixtures/great-expectations/datacontract_all_constraints.yaml - tests/fixtures/great-expectations/datacontract_quality_meta.yaml
Co-authored-by: julienguilhempartner-spec <276929201+julienguilhempartner-spec@users.noreply.github.com>
When a column has businessName='NoBV' (case-insensitive), it indicates 'No Business Value' is available. In such cases, fall back to using the column name instead to generate human-readable expectation names and expectation_ids. Changes: - Updated _display_name() to check if businessName is 'NoBV' (case-insensitive) - Falls back to column name when NoBV is detected - Added comprehensive test case covering multiple scenarios Impact: - expectation_id now uses column name instead of 'nobv' for NoBV columns - Meta names and descriptions now use column name instead of 'NoBV' - All 32 tests passing ✅ - Ruff linting: zero errors ✅
Co-authored-by: julienguilhempartner-spec <276929201+julienguilhempartner-spec@users.noreply.github.com>
Co-authored-by: julienguilhempartner-spec <276929201+julienguilhempartner-spec@users.noreply.github.com>
…metadata to suite
…expectations.py Co-authored-by: julienguilhempartner-spec <276929201+julienguilhempartner-spec@users.noreply.github.com>
Co-authored-by: julienguilhempartner-spec <276929201+julienguilhempartner-spec@users.noreply.github.com>
Co-authored-by: julienguilhempartner-spec <276929201+julienguilhempartner-spec@users.noreply.github.com>
…ns-exporter-enriched feat: Great Expectations Exporter v2.0 - Enhanced Semantic Naming & Deduplication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Improve Great Expectations expectation generation by making them more semantically rich, intelligible, and free of redundancies through humanized names, intelligent deduplication logic, and comprehensive metadata enrichment for governance and traceability.
🚀 Changes Implemented
1. Removal of expect_table_columns_to_match_ordered_list
This expectation is removed from all exports as it's rarely useful in practice
Simplifies the generated expectation suite and reduces noise in validation reports
2. Enrichment of expect_column_values_to_be_of_type Metadata
Before: empty meta
{}After: enriched meta with expectation_id, name, description, dimension, severity, checkType
Example:
order_id_must_be_of_type_varchar3. Intelligent Deduplication of Rules
When
primaryKey: true:✅ Generates
primary_key_not_nullandprimary_key_unique❌ Skips standalone required and unique (to avoid duplicates)
When
primaryKey: false:✅ Generates
not_nullifrequired: true✅ Generates
uniqueifunique: true4. Humanized Expectation Names Based on Column Names
Meta contains readable descriptions using the actual column name:
"{Column Name} must be of type {type}""{Column Name} must be filled""{Column Name} must be unique""{Column Name} must belong to allowed values"5. Standardized expectation_id in snake_case
Before: short technical IDs (column_type, not_null, pattern_match)
After: semantic names in snake_case based on column names
Examples:
order_id_must_be_of_type_varcharemail_must_match_pattern_emailquantity_must_be_between_0_and_99996. Constraint-Based Expectations Enrichment
All automatically-generated constraint expectations now include semantic governance metadata:
Added to constraint meta blocks:
{ "severity": "critical", "checkType": "technical" } This enables: - **Priority Categorization:** severity flag distinguishes critical vs. minor data quality issues - **Check Classification:** checkType indicates whether the check is technical (type validation) or functional (business logic) - **Governance Integration:** Allows downstream tools (data governance platforms, data catalogs) to filter and prioritize expectations by severity and type **Affected Constraints:** - Unique constraints → `severity: "critical"` - Required constraints → `severity: "critical"` - Primary key constraints → `severity: "critical"` - LogicalTypeOptions (pattern, enum, minLength, etc.) → `severity: "critical"` ### 7. Contract-Level Metadata Enrichment Suite-level meta blocks now include contract identity information for full traceability: **Added to suite meta:** ```json { "contract_id": "<data-contract-id>", "contract_version": "<contract-version>" }This enables:
📊 LogicalTypeOptions Coverage
All major ODCS options are now supported:
✅ Testing & Quality Assurance
📝 Technical Details
Implementation Pattern
All constraint-derived expectations receive the enhanced meta structure:
Suite-level meta structure:
📂 Files Modified
great_expectations_exporter.pytest_export_great_expectations.pydatacontract_all_constraints.yamldatacontract_quality_meta.yaml🎯 Benefits
✅ Richer metadata for better governance and traceability
✅ Semantic clarity through humanized names and descriptions
✅ Improved prioritization with severity and checkType fields
✅ Full contract lineage with contract ID and version tracking
✅ Enhanced integration with data governance platforms and tools