expect_table_columns_to_match_set
Feb 24, 2026
·
5
min read
Schema
·
dbt-expectations
·
Model,Seed,Source
How it Works
The expect_table_columns_to_match_set test from the dbt-expectations package validates that a table's columns exactly match a defined set of column names, regardless of their order. This is more lenient than expect_table_columns_to_match_ordered_list (which requires order) but stricter than expect_table_columns_to_contain_set (which allows extras). It ensures the column set is exactly right — no more and no less.
An optional transform argument enables case-insensitive matching.
Steps and Conditions
Define Column Set: List all expected column names.
Optional Transform: Apply
loweror other transforms for case-insensitive matching.Execution: The actual columns are compared against the expected set.
Outcome: Pass if the sets match exactly; fail if any columns are added or missing.
Example Usage: Data Contract
A data team has a formal data contract for the billing_summary model that specifies exactly which columns must be present, with no extras permitted.
Any schema drift — whether adding undocumented columns or removing contracted ones — causes the test to fail.





