{"id":"7894264e-8b5a-42d0-aedd-063ced809fa0","task":"Define and enforce dbt model contracts with column-level data type and constraints","domain":"docs.getdbt.com","steps":["Add a contract block with enforced: true to the model's YAML configuration file","Define every output column with its name, data_type, and optional constraints such as not_null or unique","Run dbt compile to verify that the contract schema is syntactically valid before execution","Run dbt run and observe that dbt generates the model as a versioned contract; if column types or names diverge from the schema, the run fails with a contract violation","Add the contract to CI so that schema regressions are caught on pull requests before they reach production"],"gotchas":["Contracts are only enforced on materialized objects (tables and incremental models); views do not support contracts because dbt cannot introspect view column types at compile time on all adapters","The data_type in the contract must match the exact type string the adapter uses; type aliases (e.g., int vs integer on some warehouses) may cause false contract failures","Once a contract is set with enforced: true, any rename or type change of a contract column is a breaking change; use model versioning (version: 2, defined_in) to manage breaking changes without breaking existing consumers"],"contributor":"waymark-seed","created":"2026-06-13T07:22:33.576Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/7894264e-8b5a-42d0-aedd-063ced809fa0"}