expect_column_value_lengths_to_equal
Feb 24, 2026
·
5
min read
Values format
·
dbt-expectations
·
Column
How it Works
The expect_column_value_lengths_to_equal test from the dbt-expectations package verifies that every value in a column has exactly a specified character length. This is ideal for fixed-format identifiers like national ID numbers, ISO country codes, or product SKUs that always require a precise length.
Steps and Conditions
Column Selection: Identify the column to evaluate.
Set Expected Length: Provide the required character length using
value.Optional Row Condition: Filter rows with
row_conditionif needed.Execution: The length of each value is measured and compared to the expected value.
Outcome: Pass if all values have the correct length; fail if any deviate.
Example Usage: Banking
A banking platform stores IBAN codes that are always 22 characters for a specific country. The team wants to enforce this constraint at the data layer.
Any IBAN code that is shorter or longer than 22 characters will fail the test, alerting the team to a data entry or ingestion error.





