From 73496c2cda29b14a00b95b9bc838aecca95fe961 Mon Sep 17 00:00:00 2001 From: Adrian Pasek <99073144+adrian-pasek-prv@users.noreply.github.com> Date: Sat, 23 Nov 2024 20:42:13 +0100 Subject: [PATCH 1/2] Fix compiled name of DBT_ENV_CUSTOM_ENV_MY_FAVORITE_NUMBER DBT_ENV_CUSTOM_ENV prefix is stripped during compilation --- website/docs/reference/dbt-jinja-functions/env_var.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/reference/dbt-jinja-functions/env_var.md b/website/docs/reference/dbt-jinja-functions/env_var.md index 28feccc30e4..7e85ed9797a 100644 --- a/website/docs/reference/dbt-jinja-functions/env_var.md +++ b/website/docs/reference/dbt-jinja-functions/env_var.md @@ -91,7 +91,7 @@ $ DBT_ENV_CUSTOM_ENV_MY_FAVORITE_COLOR=indigo DBT_ENV_CUSTOM_ENV_MY_FAVORITE_NUM ``` Compiles to: ```sql --- {'MY_FAVORITE_COLOR': 'indigo', 'DBT_ENV_CUSTOM_ENV_MY_FAVORITE_NUMBER': '6'} +-- {'MY_FAVORITE_COLOR': 'indigo', 'MY_FAVORITE_NUMBER': '6'} select 1 as id ``` From 07e63139e369065a62ebf3c49f9eb03922395441 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:46:45 -0500 Subject: [PATCH 2/2] Adding to contracts ref --- website/docs/reference/resource-configs/contract.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/website/docs/reference/resource-configs/contract.md b/website/docs/reference/resource-configs/contract.md index fb25076b0d9..18266ec672f 100644 --- a/website/docs/reference/resource-configs/contract.md +++ b/website/docs/reference/resource-configs/contract.md @@ -14,6 +14,13 @@ When the `contract` configuration is enforced, dbt will ensure that your model's This is to ensure that the people querying your model downstream—both inside and outside dbt—have a predictable and consistent set of columns to use in their analyses. Even a subtle change in data type, such as from `boolean` (`true`/`false`) to `integer` (`0`/`1`), could cause queries to fail in surprising ways. +## Support + +At present, model contracts are supported for: +- SQL models (not yet Python) +- Models materialized as `table`, `view`, and `incremental` (with `on_schema_change: append_new_columns` or `on_schema_change: fail`) +- The most popular data platforms — though support and enforcement of different [constraint types](/reference/resource-properties/constraints) vary by platform + ## Data type aliasing dbt uses built-in type aliasing for the `data_type` defined in your YAML. For example, you can specify `string` in your contract, and on Postgres/Redshift, dbt will convert it to `text`. If dbt doesn't recognize the `data_type` name among its known aliases, it will pass it through as-is. This is enabled by default, but you can opt-out by setting `alias_types` to `false`. @@ -91,12 +98,6 @@ When you `dbt run` your model, _before_ dbt has materialized it as a table in th 20:53:45 > in macro assert_columns_equivalent (macros/materializations/models/table/columns_spec_ddl.sql) ``` -## Support - -At present, model contracts are supported for: -- SQL models (not yet Python) -- Models materialized as `table`, `view`, and `incremental` (with `on_schema_change: append_new_columns`) -- The most popular data platforms — though support and enforcement of different [constraint types](/reference/resource-properties/constraints) vary by platform ### Incremental models and `on_schema_change`