MetricSign
EN|NLRequest Access
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

  1. 1Add a `columns:` block under the model in schema.yml with a name and data_type for each column
  2. 2Use `dbt run-operation generate_model_yaml --args '{"model_names": ["<model>"]}'` to scaffold the YAML
  3. 3Each column in the contract must have at minimum a `name` and `data_type` specified
  4. 4Run `dbt compile` after adding columns to verify the contract definition is valid before running
  5. 5If the contract is not yet needed, set `contract: {enforced: false}` until column definitions are ready

Frequently asked questions

What is the minimum required for a dbt model contract column definition?

Each column in the contract must have `name` and `data_type`. Optionally add `constraints` (not_null, primary_key) and `description`. The data_type must be a valid type for the target adapter.

Other configuration errors