From 3514253bd47e52d94724dd2c68f886f1b0e4418d Mon Sep 17 00:00:00 2001 From: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> Date: Tue, 30 Jul 2024 03:42:20 -0600 Subject: [PATCH] New page to explain context methods and variables available in properties YAML files (#5840) [Preview](https://docs-getdbt-com-git-dbeatty-properties-yml-context-dbt-labs.vercel.app/reference/dbt-jinja-functions/dbt-properties-yml-context) ## What are you changing in this pull request and why? We have pages that describe the available rendering context for these: - [`dbt_project.yml`](https://docs.getdbt.com/reference/dbt-jinja-functions/dbt-project-yml-context) - [`profiles.yml`](https://docs.getdbt.com/reference/dbt-jinja-functions/profiles-yml-context) - [`on-run-end`](https://docs.getdbt.com/reference/dbt-jinja-functions/on-run-end-context) But not for these: - [`packages.yml` and/or `dependencies.yml`](https://docs.getdbt.com/docs/build/packages#use-cases) - [properties YAML files](https://docs.getdbt.com/reference/configs-and-properties)(e.g., `properties.yml`, `schema.yml`, `_models.yml`, `_unit_tests.yml`, `whatever_name_you_want.yml`, etc.) This PR addresses the rendering context for **properties YAML files**. `packages.yml` and `dependencies.yml` will need to be covered in a separate PR. ## Checklist - [x] Review the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines. Adding pages: - [x] Add page in `website/sidebars.js` (wasn't needed) - [x] Provide a unique filename for new pages --------- Co-authored-by: Mirna Wong <89008547+mirnawong1@users.noreply.github.com> --- .../properties-yml-context.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 website/docs/reference/dbt-jinja-functions/properties-yml-context.md diff --git a/website/docs/reference/dbt-jinja-functions/properties-yml-context.md b/website/docs/reference/dbt-jinja-functions/properties-yml-context.md new file mode 100644 index 00000000000..795785bb56e --- /dev/null +++ b/website/docs/reference/dbt-jinja-functions/properties-yml-context.md @@ -0,0 +1,34 @@ +--- +title: " About properties.yml context" +sidebar_label: "properties.yml context" +id: "dbt-properties-yml-context" +description: "The context methods and variables available when configuring resources in a properties.yml file." +--- + +The following context methods and variables are available when configuring +resources in a `properties.yml` file. + +**Available context methods:** +- [env_var](/reference/dbt-jinja-functions/env_var) +- [var](/reference/dbt-jinja-functions/var) + +**Available context variables:** +- [target](/reference/dbt-jinja-functions/target) +- [builtins](/reference/dbt-jinja-functions/builtins) +- [dbt_version](/reference/dbt-jinja-functions/dbt_version) + +### Example configuration + + + +```yml +# Configure this model to be materialized as a view +# in development and a table in production/CI contexts + +models: + - name: dim_customers + config: + materialized: "{{ 'view' if target.name == 'dev' else 'table' }}" +``` + +