Skip to main content
Back to Academy✅ 4. Governance, Contracts & Regulatory Compliance
5 min read
Try Hands-on Lab
VISUAL LESSON4. Governance, Contracts & Regulatory Compliance

ISO 8000 Data Quality Engineering: Assertions, Nulls & Drift

Practical beginner guide to ISO 8000-61 Data Quality Engineering—implementing Completeness, Syntactic Accuracy, Semantic Accuracy, Consistency, Uniqueness, and Timeliness checks in SQL and Delta pipelines.

ISO 8000-61 Data Quality6 Dimensions of Data QualityData Quality SQL AssertionsDelta Live Tables EXPECTCompleteness Syntactic Semantic AccuracyData Pipeline Circuit Breaker

Explain Like I'm New: Quality Control on an Assembly Line

Imagine running a bottled water factory without automated quality sensors: - Some bottles leave with no label (missing data) - Some say "Exp: Banana-99" instead of a date (syntax error) - Some claim a 500 ml bottle weighs 4,000 kg (business impossibility) - Two bottles somehow carry the exact same serial number (duplicate ID)

Wait until a supermarket calls to complain? That ruins trust! Instead, factories install automated pass/quarantine gates right on the conveyor belt.

ISO 8000-61 is the international framework defining those exact data conveyor-belt rules across 6 measurable dimensions.

Key Beginner Takeaway: Never hope upstream data arrives clean. Write explicit SQL quality assertions for every Bronze -> Silver -> Gold transition, routing bad rows cleanly to a Quarantine table instead of silently dropping data or crashing dashboards!

The 6 Core Dimensions of ISO 8000-61 Data Quality (With SQL Examples)

ISO 8000-61:2016 (Data quality management: Process reference model) and DAMA-DMBOK2 formalize enterprise quality evaluation across 6 core dimensions:

1. Completeness *Question:* **Are mandatory fields present (not NULL or empty whitespace)?**

SELECT COUNT(*) AS missing_keys
FROM silver.deposits_return
WHERE account_id IS NULL OR TRIM(account_id) = '';

2. Syntactic Accuracy *Question:* **Does the value match the required structural format, pattern, or data type?** (ISO country codes, email regex, ISO-8601 dates, valid IBAN/currency format)

SELECT COUNT(*) AS invalid_currency_format
FROM silver.deposits_return
WHERE NOT REGEXP_LIKE(currency_code, '^[A-Z]{3}$');

3. Semantic Accuracy *Question:* **Does the value make true real-world business sense within domain bounds?** (For example, `ledger_balance >= -5000.00` approved overdraft threshold in **ex-16**, or `birth_date <= CURRENT_DATE` so nobody has an age of `-3`!)

SELECT COUNT(*) AS impossible_balances
FROM silver.deposits_return
WHERE ledger_balance < -5000.00 OR ledger_balance > 1000000000.00;

4. Consistency *Question:* **Do related columns and linked tables agree with each other?** For example: `ship_date >= order_date`, `line_total = qty * unit_price`, and every child `customer_id` exists in `dim_customer`!

SELECT COUNT(*) AS inconsistent_dates
FROM silver.shipments
WHERE delivered_date < shipped_date;

5. Uniqueness *Question:* **Are entity Primary Keys strictly duplicate-free at the declared grain?**

SELECT account_id, COUNT(*) AS dup_count
FROM silver.deposits_return
GROUP BY account_id
HAVING COUNT(*) > 1;

6. Timeliness *Question:* **Did data arrive fresh inside the agreed SLA window?**

SELECT MAX(event_timestamp) AS latest_event
FROM silver.deposits_return
HAVING MAX(event_timestamp) < CURRENT_TIMESTAMP() - INTERVAL 24 HOURS;

Three Real-World Actions When a Quality Check Fails (**Circuit Breakers**)

Not every error deserves halting the whole company pipeline at 3 AM! Choose the right response per severity:

StrategyBehavior on Failing RowWhen to Use
WARN / LOGAllow row through, increment monitoring metric + Slack alert.Non-critical optional fields (e.g., marketing_referrer missing).
QUARANTINE (Drop & Route)Move failing row cleanly to quarantine.bad_rows with failure_reason, pass healthy rows forward!Single corrupt webhook records (email = 'invalid', malformed JSON).
FAIL JOB (Circuit Breaker)Abort entire pipeline before overwriting Gold (FAIL UPDATE). Keeps yesterday's valid Gold snapshot intact!Duplicate Primary Keys, orphan revenue accounts, > 5% sudden row-count drop (Volume Drift)!

Declarative Expectations Example (Databricks / Lakeflow SQL)

CREATE OR REFRESH STREAMING TABLE silver_certified_deposits (
  CONSTRAINT valid_account_pk   EXPECT (account_id IS NOT NULL)        ON VIOLATION FAIL UPDATE,
  CONSTRAINT valid_currency     EXPECT (currency_code RLIKE '^[A-Z]{3}$') ON VIOLATION DROP ROW,
  CONSTRAINT valid_overdraft    EXPECT (ledger_balance >= -5000.00)    ON VIOLATION FAIL UPDATE
)
AS SELECT * FROM STREAM(bronze_raw_deposits);

Common Beginner Mistakes (And How to Fix Them)

  1. Treating `DROP ROW` silently without a Quarantine table: Dropping bad rows into a black hole hides missing revenue! Always store rejected rows in a dead-letter/quarantine table for engineering replay.
  2. Checking only row-level rules and ignoring Volume Drift: If an upstream API accidentally sends 0 rows today, every row-level IS NOT NULL check passes 100%! Always add a completeness volume check (today_rows >= 0.5 * 7day_avg_rows).
  3. Validating in Gold only: Catch quality issues at Silver ingestion so Gold transformations never inherit garbage.

Quick Cheat Sheet

  1. Memorize the 6 ISO 8000-61 pillars: Completeness, Syntactic Accuracy, Semantic Accuracy, Consistency, Uniqueness, Timeliness.
  2. Use WARN, QUARANTINE, or FAIL (Circuit Breaker) intentionally based on blast radius.
  3. Combine row-level rules with table-level volume/drift checks.

Comprehension & Architecture Check (3 Questions)

Test your understanding of the concepts covered in this lesson.

1. Under ISO 8000-61 and DAMA-DMBOK2, checking that retail overdrafts do not exceed authorized limits (e.g. balance >= -5000.00) represents which quality dimension?
2. Why should beginners check a table's grain before writing a JOIN?
3. Which Medallion layer is meant to store clean, deduplicated, standardized records?
Practice What You Learned

EX-16: Codifying ISO 8000-61 Quality Dimensions (Semantic Accuracy)

A junior analyst added a naive filter WHERE ledger_balance >= 0, assuming bank accounts can never have negative balances. This accidentally threw away millions of pounds in legitimate authorized customer overdrafts. In financial data engineering, an overdraft is a valid negative balance up to the agreed credit limit (e.g. down to -£5,000.00). We need an accurate data quality assertion rule.

Solve Challenge