When to use this
Raw data often contains rows that shouldn’t make it into your analytics — test records, incomplete entries, or data that violates business rules. Rather than letting bad data silently corrupt dashboards and reports, filter it out (or flag it) during the transformation step. Common scenarios include:- Removing test or sandbox records (e.g., emails ending in
@test.com) - Excluding rows with missing required fields
- Filtering out records outside a valid date range
- Flagging anomalous values for review
Sample input
Anorders table in the Raw layer with some invalid records:
We want to keep only rows where: the email is not a test address, the amount is positive, and the email is not NULL.
Implementation
- Nekt Express / BigQuery
- Athena SQL
- Python (Nekt SDK)
Apply the same
WHERE filters. BigQuery’s REGEXP_CONTAINS can be useful for more complex patterns.Expected output
Rows 1002 (test email), 1003 (negative amount), and 1004 (NULL email) are excluded.
Tips and gotchas
Keep your validation rules documented and versioned. When business rules change (e.g., a new test domain gets added), you’ll want to update the filter in one place rather than hunting for hardcoded values across multiple transformations.