not_accepted_values
How it Works
The not_accepted_values test from dbt-utils™ is the logical complement of the built-in accepted_values test. It asserts that a column contains no values from a specified list. This is useful for enforcing data quality rules where certain values should never appear — for example, deprecated status codes, placeholder strings, or system-generated sentinel values.
Steps and Conditions
- Column Selection: Choose the column to validate.
- Define Disallowed Values: List the values that must not appear using the
valuesargument. - Execution: Each row is checked against the disallowed list.
- Outcome: Pass if no disallowed values are found; fail if any are present.
Example Usage: CRM Platform
A CRM platform decommissioned several legacy lead source codes. The team wants to ensure these codes are fully purged from the active leads table.
models:
- name: leads
columns:
- name: lead_source
tests:
- dbt_utils.not_accepted_values:
values: ['imported_legacy', 'manual_entry_v1', 'unknown_source']Any appearance of these deprecated codes triggers a test failure, alerting the team to investigate the source of stale data.
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.