Skip to content

Commit

Permalink
New page to explain context methods and variables available in proper…
Browse files Browse the repository at this point in the history
…ties 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]>
  • Loading branch information
dbeatty10 and mirnawong1 authored Jul 30, 2024
1 parent 3be89f5 commit 3514253
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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

<File name='properties.yml'>

```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' }}"
```
</File>

0 comments on commit 3514253

Please sign in to comment.