Lesson 4 of 5 Data Quality

Gating Data with Validation and Quarantine

This lesson explains how validation gates decide where checks run and what happens to data that fails, so that bad data does not reach consumers.

Learning outcomes

After completing this lesson, you will be able to:

  • Place validation gates at pipeline boundaries.
  • Choose between blocking publication and quarantining failed records.
  • Write rules for completeness, validity, consistency, timeliness and volume.

Where to check

Validation gates sit at the boundaries of a pipeline, and each boundary has its own checks. At ingestion, checks confirm the schema, file format and required fields, and detect a whole file delivered twice. After transformation, checks apply business rules and referential integrity, and compare row counts with the source to catch rows lost or multiplied by a join. Before publishing, checks confirm the final dataset is complete and fresh. At rest, scheduled rules on important catalogue tables catch problems that arrive outside the pipeline. The following table summarises the checks.

BoundaryWhat to check
IngestionSchema, file format, required fields, duplicates of whole files
After transformationBusiness rules, referential integrity, row counts against the source
Before publishingCompleteness and freshness of the final dataset
At restScheduled catalog-level rules on important tables
Sort into groups

Which boundary?

Exam skills 3.4.1

Decide at which boundary each validation belongs.

Log in to try this activity Interactive activities are free with an account.

What to do with failures

A validation gate decides what happens to data that fails quality checks, and the right choice depends on whether publishing bad data or publishing late is worse. The strictest option is to fail the run, acting as a circuit breaker, when incorrect data would cause more harm than a delay, for example in financial reporting.

A more forgiving option is to quarantine the failing rows, together with the rules they broke, and load the rest. Write-audit-publish combines both: data is written to a staging area or an Apache Iceberg branch, audited there, and only then published, by fast-forwarding the branch or swapping a view, so consumers never see data that has not passed its checks. For new datasets, whose normal values are not yet known, checks may alert only while thresholds are tuned.

The following diagram shows the write-audit-publish flow.

Write-audit-publish for the finance table. The nightly job writes to a staging location or an Iceberg branch, where quality rules check row counts against the expected sources and completeness. Only if they pass is the branch published; otherwise the previous version stays live and the team is alerted, so finance never sees partial numbers.
A view swap gives the same effect without Iceberg branches.
Scenario questions

Failing or quarantining?

Exam skills 3.4.1

Choose how a validation gate should respond.

Log in to try this activity Interactive activities are free with an account.

Rules

Rules usually cover completeness (no missing values), uniqueness, validity (allowed values, formats, ranges), consistency across datasets, timeliness, and volume. AWS Glue Data Quality uses DQDL (built on Deequ) and can recommend rules from data profiles. Dynamic rules compare with recent runs, for example RowCount > avg(last(10)) * 0.8, and anomaly detection learns normal patterns without fixed thresholds.

Fill in the value

Dynamic rules

Exam skills 3.4.2

Evaluate a dynamic row count rule.

Log in to try this activity Interactive activities are free with an account.
Worked example

A finance dashboard occasionally shows partial numbers because the nightly job publishes a table while some source files are still missing. Finance would rather see yesterday's numbers than wrong ones.

Use write-audit-publish: write to a staging location or Iceberg branch, run quality rules (row counts against expected sources, completeness), and publish only if they pass; otherwise keep the previous version and alert. Quarantining rows would not help, because the problem is missing data, not bad rows.

Check yourself

What does the write-audit-publish pattern guarantee?

Show answer

Consumers never see data that has not passed its checks, because data is published only after it is audited.

Exam Tips

Remember for the exam

  • Check data at ingestion, after transformation, before publishing and at rest.
  • Fail runs when bad data is worse than late data; quarantine rows when partial data is acceptable.
  • Write-audit-publish ensures consumers never see unaudited data.
  • Glue Data Quality uses DQDL, recommends rules, and supports dynamic rules and anomaly detection.
  • Alert only while thresholds for a new dataset are being tuned.