Quality gates: Glue Data Quality and DataBrew profiles
Lesson 1 of 5 in Data Quality, Labeling, and Bias.
Domain 1's quiet thesis: validate before you train, because a model trained on broken data is a broken model with good manners. AWS Glue Data Quality turns validation into an enforceable gate — you declare rules in DQDL (Data Quality Definition Language), Glue evaluates them against a dataset, and the result is a pass/fail per rule plus an overall score your pipeline can act on. Glue can even recommend a starter ruleset by profiling the data first.
It runs in two places. At rest, against Data Catalog tables — a standing health check on datasets. In the pipeline, inside a Glue ETL job — evaluate mid-flight, then route: quarantine failing rows, fail the job, or publish results and alert (CloudWatch/EventBridge) while the batch proceeds. The in-pipeline form is what exam stems mean by "prevent bad data from reaching the training set."
The profiling complement is DataBrew: a profile job computes missing-value rates, cardinality, distributions, correlations, and outlier counts over a dataset with zero code — the fastest honest look at a dataset you have never met.
The quality gate in the pipeline
- Raw batch arrives
- DataBrew profile
Zero-code statistics — missing rates, cardinality, distributions, outliers. The honest first look that tells you which rules are worth writing.
- Glue DQ ruleset (DQDL)
RowCount, Completeness, ColumnValues, Uniqueness — evaluated inside the Glue ETL job, producing per-rule verdicts and an overall score.
- All rules pass?
- Training path
The batch proceeds to the training location — quality was a gate, not a morning-after report.
- Quarantine failing rows
Failing rows route to a quarantine location (or the whole job fails) before anything reaches the training set.
- Alert the owners
Results publish to CloudWatch/EventBridge so a human investigates while good data keeps flowing.
| Glue Data Quality | DataBrew profile | |
|---|---|---|
Produces | Rule verdicts + a quality score | Statistics: missing %, cardinality, distributions, correlations |
Authored as | DQDL rules (recommendations available) | Point-and-click; optional validation rulesets |
Runs | On Catalog tables or inside Glue ETL jobs | As a profile job from the DataBrew console |
Use when | Enforcing a gate in production pipelines | Understanding a new dataset fast, analyst-owned checks |
The profile found outliers — now what?
Investigate before touching: a $2M transaction may be fraud signal, not noise. If treatment is warranted, cap/winsorize (keep the row, clamp the value), remove (only for verified errors), or switch to robust methods (median/IQR scaling, tree models). Deleting inconvenient real data manufactures bias.
The profile found missing values — now what?
Simple imputation: median (robust to outliers) or mean for numerics, mode for categoricals. Model-based imputation (e.g. k-NN) uses other columns to predict the gap. Often the strongest move: add a missing-indicator column — that it was missing can itself be signal. Fit any imputer on the training split only.
The profile found duplicates — now what?
Deduplicate before splitting — exact dupes first, then near-duplicates (same record, trivially different formatting). A duplicate that lands in both train and test lets the model "recall" test answers: inflated metrics, instant leakage.
Interactive checkpoint quiz (2 questions) — open this page in a browser to take it.