# Add data quality assertions to BigQuery pipelines Write ASSERT checks for required fields, key uniqueness, accepted values and freshness, and let a failed job block the pipeline before bad rows reach reports. - Canonical: https://satracking.net/guides/bigquery-data-quality-assertions/ - Language: en - Category: validation - Level: intermediate - Published: 2026-11-14 - Updated: 2026-11-14 --- Write ASSERT checks for required fields, key uniqueness, accepted values and freshness, and let a failed job block the pipeline before bad rows reach reports. It focuses on clear definitions, correct analytical scope and checks that make conclusions reproducible. ## Define the analytical question State the decision or question the analysis must support. Specify the population, unit of analysis, time window and metric scope. Identify the source fields and transformations required, and record assumptions that could change the result. ## Apply a repeatable method Translate data contracts into executable checks; test key uniqueness, required fields, accepted values and freshness; compare totals with source controls; define severity and thresholds; fail or quarantine data according to business impact. ## Check interpretation and edge cases A successful SQL job does not prove that its output is correct. Assertions should test business invariants and surface failures to an owner. Validate the result with a small known example, inspect missing or duplicated records, and compare equivalent periods and populations. Keep the denominator visible and distinguish observed behavior from causal explanation. ## Make the analysis reproducible Record the report configuration, query or exploration settings, source freshness and definition version. Share a concise interpretation with limitations and next actions. Re-run the same checks after material tracking, schema or business-process changes. ## Review checklist - Is the population, grain and time window explicit? - Do the selected fields match the intended scope? - Have duplicates, missing values and boundary cases been checked? - Are limitations and assumptions visible? - Can another analyst reproduce the result? ## Official references - Debugging statements: ASSERT — https://cloud.google.com/bigquery/docs/reference/standard-sql/debugging-statements (verified 2026-11-14) - Use primary and foreign keys — https://cloud.google.com/bigquery/docs/primary-foreign-keys (verified 2026-11-14)