Medium severityconfiguration
Power BI Refresh Error:
dbt Model Contract: No Columns Defined
What does this error mean?
A dbt model has `contract: {enforced: true}` in its config but has no column definitions in the schema.yml file. dbt requires explicit column-level data type definitions when a contract is enforced.
Common causes
- 1Model config sets `contract.enforced: true` but the corresponding schema.yml entry has no columns block
- 2Contract enforcement added to a model file without adding the required column definitions in schema.yml
- 3Model migrated from one project to another without copying the contract column definitions
- 4Auto-generated schema.yml missing the columns section for contracted models
How to fix it
- 1Add a `columns:` block under the model in schema.yml with a name and data_type for each column
- 2Use `dbt run-operation generate_model_yaml --args '{"model_names": ["<model>"]}'` to scaffold the YAML
- 3Each column in the contract must have at minimum a `name` and `data_type` specified
- 4Run `dbt compile` after adding columns to verify the contract definition is valid before running
- 5If the contract is not yet needed, set `contract: {enforced: false}` until column definitions are ready