Skill 1.3.1: Validate Data Quality (DataBrew, AWS Glue Data Quality)
Task 1.3: Data Preparation for ML and AI – Validate data quality and manage bias
Core objective: Prove data is complete, consistent, and within expected ranges before training. Automate validation as a gate; manual sampling is an anti-pattern.
Service Selection
| Service | Primary Role | Best For | Key Limitation |
|---|---|---|---|
| AWS Glue Data Quality | Declarative rulesets (DQDL) | Repeatable pipeline validation, gates | Requires Data Catalog table; DQDL learning curve |
| AWS Glue DataBrew | Visual profiling & cleaning | Exploratory data prep, 250+ transforms | Not for automated rule enforcement |
| SageMaker Data Wrangler | ML-specific cleaning & bias | Feature engineering, bias detection | Part of SageMaker Studio |
| Amazon Comprehend | PII detection in text | Cleaning & safety screening | Text only (EN/ES) |
| CloudWatch | Monitoring | Alarms on DQ failures | Not a validation engine |
AWS Glue Data Quality – Key Concepts
- DQDL: Declarative rules (Completeness, Uniqueness, ColumnValues, RowCount, Mean, etc.).
- Ruleset: Attached to Data Catalog table or evaluated in Glue ETL.
- Auto-suggest: Generates candidate rules from profile; review before enforcing.
- Evaluation: Schedule, ETL, or API. Results to CloudWatch & Data Catalog.
- Integration: Glue ETL, Studio, Step Functions, EventBridge.
- Security: IAM role for S3/Glue; KMS at rest; TLS in transit; VPC endpoints.
Exam Gotcha: DQDL rules break on schema evolution. Monitor and update rulesets.
AWS Glue DataBrew – Key Concepts
- Profile Job: Scans data → missing values, distinct counts, min/max, outliers, correlations.
- Recipe: Versioned transforms (cleaning steps). Output to S3.
- Use Case: Understand data before choosing cleaning approach.
- Security: IAM role for S3/Glue; KMS; VPC endpoints.
Exam Gotcha: DataBrew profiles and cleans; it does NOT enforce declarative rules at scale. Use Glue Data Quality for gates.
Data Quality Dimensions & Rules
| Dimension | DQDL Example | DataBrew Profile Indicator |
|---|---|---|
| Completeness | Completeness "col" > 0.98 |
Missing value % |
| Uniqueness | Uniqueness "id" = 1.0 |
Distinct count |
| Validity | ColumnValues "age" between 18 and 100 |
Min/max, outliers |
| Consistency | ColumnValues "date" matches "YYYY-MM-DD" |
Format consistency |
| Accuracy | Mean "revenue" between 1000 and 5000 |
Mean, std dev |
When to Use Which
| Need | Recommended |
|---|---|
| Declarative, repeatable rules on every run | AWS Glue Data Quality |
| Visual profiling to understand data | AWS Glue DataBrew |
| ML feature engineering & bias detection | SageMaker Data Wrangler |
| PII detection in text | Amazon Comprehend |
| Monitoring DQ failures | CloudWatch + SNS |
Anti-Patterns & Traps
- Manual sampling as validation: Misses rare defects; use automated rules.
- Profiling without cleaning: DataBrew reveals issues; must apply recipe or fix upstream.
- Ignoring schema drift: DQDL rules may fail silently. Monitor.
- Using DataBrew for enforcement: Interactive, not a gate.
- Blind mean imputation: Pulls distribution to center; consider dropping or model-based.
- Duplicating rare class without variation: Deepens representation bias.
- Skipping PII screening: Use Comprehend or Bedrock Guardrails.
Security & Compliance
- IAM: Least privilege for Glue/DataBrew to S3, Data Catalog, CloudWatch.
- Encryption: KMS at rest (S3, Data Catalog); TLS in transit.
- VPC: VPC endpoints for private access.
- Audit: CloudTrail + CloudWatch logs.
ML Pipeline Integration
- Pre-training gate: Run Glue Data Quality before SageMaker training; fail pipeline on rule failure.
- Feature Store: Validate before ingesting into SageMaker Feature Store.
- Bias detection: Data quality is prerequisite; use SageMaker Clarify after cleaning.
- Monitoring: CloudWatch alarms on DQ rule failures → SNS.
Hard Rule: Data quality validation must be automated, repeatable, and integrated into CI/CD. Manual checks are not production-ready.
Default Quota: Glue Data Quality limits rules per ruleset (e.g., 100). Check current AWS quotas.