EX-21: Data Delivery Agreement (DDA) Temporal Assertion
Track: Circuit Breakers & RCA • Difficulty: Intermediate • Mastery Points: 150 PTS
Business Problem Scenario
Under formal Data Delivery Agreement DDA-PROD-CAT-001, Product Operations contractually guarantees that silver.product_catalog maintains continuous temporal validity with zero overlapping date intervals and zero unmapped date gaps across versions. If two versions of a product overlap, 'as-of' joins produce Cartesian explosion; if a gap exists, customer balances fail to match any product category. You must write an automated verification query that flags overlapping date intervals.
Engineering Objective
Write a temporal assertion query over silver.product_catalog to detect date interval violations. • Expected Columns: product_code, effective_from, effective_to, prev_to, has_temporal_violation • Temporal Partitioning & Ordering: - Must partition window check by business key: OVER (PARTITION BY product_code ORDER BY effective_from). - Inspect preceding record closing date: LAG(effective_to) OVER (PARTITION BY product_code ORDER BY effective_from) AS prev_to. - Flag violation: effective_from > effective_to OR effective_from <= prev_to. Key Concepts: - Data Delivery Agreement (DDA): Formal operational contract between data producers and consumers specifying SLA bounds. - Temporal Disjointness: Absolute mathematical guarantee that validity ranges for an entity never overlap.
Target Table: silver.product_catalog (product_code STRING, product_name STRING, category_l1 STRING, effective_from DATE, effective_to DATE)
Verification & Architecture Insights
Contractual DDA assertions execute during schema merge requests, blocking corrupted reference tables from entering the lakehouse.