[Data Validation] Add source_record_key column to MismatchedRecords#3962
Draft
aasthabharill wants to merge 1 commit into
Draft
[Data Validation] Add source_record_key column to MismatchedRecords#3962aasthabharill wants to merge 1 commit into
aasthabharill wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3962 +/- ##
============================================
+ Coverage 55.64% 63.36% +7.72%
+ Complexity 6731 2455 -4276
============================================
Files 1117 528 -589
Lines 68313 30592 -37721
Branches 7696 3396 -4300
============================================
- Hits 38012 19385 -18627
+ Misses 27829 10196 -17633
+ Partials 2472 1011 -1461
🚀 New features to boost your workflow:
|
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.
b/519409134
Issue
Mismatched rows are reported in the format: [spanner_pk_columns: source_values] even for rows that are MISSING_IN_DESTINATION.
Impact
Fix
source_record_keycolumns that stores the Source PK column values in MismatchedRecords table.record_keytospanner_record_keyfor clarityprimaryKeysinformation as this is required to populatesource_record_key.isPKTransformedto clearly call out to user when they need to care aboutsource_record_key. When this is false,source_record_key=spanner_record_keyAlternative Approaches
Store source PK details in
record_keycolumn instead of equivalent spanner PK for rows that are MISSING_IN_DESTINATION and don't have spanner row.Reason for rejection:
record_keycolumn will have identical values.Therefore, it's important to maintain BOTH source PK data and the computed equivalent spanner PK.
Design Decisions
When to hard fail the pipeline and why?
The pipeline will hard fail in the following scenarios:
We hard fail here as the
source_record_keycolumn is dependent on this metadata, and won't work without it. So it's better to quickly stop the pipeline.The pipeline does NOT hard fail if a primary key column has NULL value as this is allowed by some databases and shouldn't be enforced by a validation pipeline IMO.