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.
| Boundary | What to check |
|---|---|
| Ingestion | Schema, file format, required fields, duplicates of whole files |
| After transformation | Business rules, referential integrity, row counts against the source |
| Before publishing | Completeness and freshness of the final dataset |
| At rest | Scheduled catalog-level rules on important tables |
Which boundary?
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.

Failing or quarantining?
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.
Dynamic rules
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.
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.