How would you set up data quality checks and alerts for schema drift, null rates and out-of-range values in a pipeline?
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Other
How would you set up data quality checks and alerts to catch issues early in a data pipeline, such as schema drift, null rates, and out-of-range values?
```hint Place the checks
Think about the stages a batch passes through on its way to consumers, and which kind of failure is cheapest to catch at each stage.
```
```hint Thresholds that do not cry wolf
A fixed limit on null rate or row count either misses real breaks or fires every weekend. Consider what baseline each batch should be compared against.
```
### Clarifying Questions to Ask
- Is the pipeline batch, streaming, or both, and how often does new data land?
- Who consumes the output (dashboards, model features, billing), and which costs more for them: a bad row or a late table?
- Do upstream producers commit to a schema or data contract, or can they change fields without notice?
- Which orchestration and alerting tools are already in place?
### What a Strong Answer Covers
- The categories of checks (schema, completeness, validity, volume and freshness, uniqueness, distribution) with a concrete example of each
- Where the checks run in the pipeline, and how a failed batch is kept away from consumers
- How thresholds come from history and seasonality, and how severity decides between failing the run, quarantining rows and warning
- Alert routing, ownership and runbooks that keep alerts actionable
- How the checks are codified, versioned and tested alongside the pipeline code
### Follow-up Questions
- An upstream team renames a column on Friday night. Walk through what your system does, step by step.
- How would you catch a units change in a numeric field (say, dollars to cents) when the new values still fall inside the allowed range?
- How do you keep alert volume low enough that people still respond to alerts?
- A bad batch already reached downstream tables before anyone noticed. How do you find what it touched and repair it?
Overview: Asks how to design data quality checks and alerting for a data pipeline that catch schema drift, rising null rates and invalid values before they reach downstream users. Tests where checks belong in a pipeline, how thresholds are set, and how failures are handled and routed.