not_null

Feb 23, 2026dbt-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

  1. Column Selection: Identify the column to validate.
  2. Execution: Every row is checked for null values.
  3. 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_null

This 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.