at_least_one
How it Works
The at_least_one test from dbt-utils™ validates that a column contains at least one non-null value. While simple, this test is an important safety net to detect empty or fully-null columns that would silently break downstream aggregations or lookups. It's commonly applied to key columns in models that should always have data.
Steps and Conditions
- Column Selection: Identify the column to evaluate.
- Execution: The test checks whether any non-null value exists in the column.
- Outcome: Pass if at least one non-null value is found; fail if all values are null.
Example Usage: Product Inventory
A product inventory model should always have at least one active SKU. The team applies at_least_one to ensure the table is never fully empty after a transformation.
models:
- name: active_inventory
columns:
- name: sku
tests:
- dbt_utils.at_least_oneA completely null sku column would indicate a failed data load, which this test will catch immediately.
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.