Skip to main content

About packages.yml context

The following context methods and variables are available when configuring a packages.yml file.

Available context methods:

  • env_var
    • Use env_var() in any dbt YAML file that supports Jinja. Only packages.yml and profiles.yml support environment variables for secure values (using the DBT_ENV_SECRET_ prefix).
  • var (Note: only variables defined with --vars are available. Refer to YAML tips for more information)

Available context variables:

Example usage

The following examples show how to use the different context methods and variables in your packages.yml.

Use builtins in your packages.yml:

packages:
- package: dbt-labs/dbt_utils
version: "{% if builtins is defined %}0.14.0{% else %}0.13.1{% endif %}"

Use env_var in your packages.yml:

packages:
- package: dbt-labs/dbt_utils
version: "{{ env_var('DBT_UTILS_VERSION') }}"

Use dbt_version in your packages.yml:

packages:
- package: dbt-labs/dbt_utils
version: "{% if dbt_version is defined %}0.14.0{% else %}0.13.1{% endif %}"

Use target in your packages.yml:


packages:
- package: dbt-labs/dbt_utils
version: "{% if target.name == 'prod' %}0.14.0{% else %}0.13.1{% endif %}"

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0
Loading