not_null
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.
models:
- name: customers
columns:
- name: customer_id
tests:
- not_nullThis ensures that every customer record has a valid identifier, preventing broken joins and missing records in all downstream models.
Interested to Learn More? Try Out the Free 14-Days Trial
One AI-native workspace to build, ship, and monitor dbt™ — without the tool sprawl.
Join industry leaders winning with DinoAI agents
Data engineers and analysts at the most AI-native startups and enterprises use Paradime's DinoAI agents everyday to become market leaders.