Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
  • Loading branch information
matthewshaver authored Feb 27, 2023
commit 23ee4ef27fab2534b8b361cd6b32b5b8ac481de9
4 changes: 2 additions & 2 deletions website/docs/docs/collaborate/publish/model-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For more details and to leave your feedback, join the GitHub discussion:

Defining a dbt model is as easy as writing a SQL `select` statement or a Python Data Frame transformation. Your query naturally produces a dataset with columns of names and types based on the columns you select and the transformations you apply.

While this is ideal for quick and iterative development, for some models, constantly changing the shape of its returned dataset poses a risk when other people and processes are querying that model. It's better to define a set of upfront attestations that guarantee the shape of your model. We call this set of attestations a "contract." While building your model, dbt will verify that your model's transformation will produce a dataset matching up with its contract, or it will fail to build.
While this is ideal for quick and iterative development, for some models, constantly changing the shape of its returned dataset poses a risk when other people and processes are querying that model. It's better to define a set of upfront "guarantees" that define the shape of your model. We call this set of guarantees a "contract." While building your model, dbt will verify that your model's transformation will produce a dataset matching up with its contract, or it will fail to build.

## How to define a contract

Expand Down Expand Up @@ -67,7 +67,7 @@ models:
</File>

When building a model with a defined contract, dbt will do two things differently:
1. dbt will run a preliminary verification check to ensure that the model's query will return a set of columns with names and data types matching the ones you have defined.
1. dbt will run a "preflight" check to ensure that the model's query will return a set of columns with names and data types matching the ones you have defined.
2. dbt will pass the column names, types, `not_null`, and other constraints into the DDL statements it submits to the data platform, which will be enforced while building the table.

## FAQs
Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/resource-configs/contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This functionality is new in v1.5. These docs exist to provide a high-level over

In particular:
- The current name of the `contract` config is `constraints_enabled`.
- The verification check includes column `name` only and is order-sensitive. The goal is to add `data_type` and make it insensitive to column order.
- The "preflight" check only includes column `name` and is order-sensitive. The goal is to add `data_type` and make it insensitive to column order.
:::

# Definition
Expand Down