not_null
dbt-core
·
Model,Column
·
Null handling
How it Works
The not_null test is one of dbt™'s four built-in generic tests. It validates that a column contains no null values. This is the most fundamental data completeness check in dbt™ and is typically applied to primary keys, foreign keys, and any column that downstream logic depends on being populated.
Steps and Conditions
Column Selection: Identify the column to validate.
Execution: Every row is checked for null values.
Outcome: Pass if no nulls are found; fail if any nulls are present.
Example Usage: Customer Table
A customer table should never have a null customer_id, as it would break all downstream joins and aggregations.
This ensures that every customer record has a valid identifier, preventing broken joins and missing records in all downstream models.

