Skip to content

Commit 3514253

Browse files
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 <[email protected]>
1 parent 3be89f5 commit 3514253

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: " About properties.yml context"
3+
sidebar_label: "properties.yml context"
4+
id: "dbt-properties-yml-context"
5+
description: "The context methods and variables available when configuring resources in a properties.yml file."
6+
---
7+
8+
The following context methods and variables are available when configuring
9+
resources in a `properties.yml` file.
10+
11+
**Available context methods:**
12+
- [env_var](/reference/dbt-jinja-functions/env_var)
13+
- [var](/reference/dbt-jinja-functions/var)
14+
15+
**Available context variables:**
16+
- [target](/reference/dbt-jinja-functions/target)
17+
- [builtins](/reference/dbt-jinja-functions/builtins)
18+
- [dbt_version](/reference/dbt-jinja-functions/dbt_version)
19+
20+
### Example configuration
21+
22+
<File name='properties.yml'>
23+
24+
```yml
25+
# Configure this model to be materialized as a view
26+
# in development and a table in production/CI contexts
27+
28+
models:
29+
- name: dim_customers
30+
config:
31+
materialized: "{{ 'view' if target.name == 'dev' else 'table' }}"
32+
```
33+
34+
</File>

0 commit comments

Comments
 (0)