Skip to main content

group

dbt_project.yml
models:

<resource-path>:
+group: GROUP_NAME

models/schema.yml
version: 2

models:
- name: MODEL_NAME
config:
group: GROUP # changed to config in v1.10

models/<modelname>.sql

{{ config(
group='GROUP_NAME'
) }}

select ...

Note that for backwards compatibility, group is supported as a top-level key, but without the capabilities of config inheritance.

Definition

An optional configuration for assigning a group to a resource. When a resource is grouped, dbt will allow it to reference private models within the same group.

For more details on reference access between resources in groups, check out model access.

Examples

Prevent a 'marketing' group model from referencing a private 'finance' group model

This is useful if you want to prevent other groups from building on top of models that are rapidly changing, experimental, or otherwise internal to a group or team.

models/schema.yml
models:
- name: finance_model
config:
group: finance # changed to config in v1.10
access: private # changed to config in v1.10
- name: marketing_model
config:
group: marketing # changed to config in v1.10
models/marketing_model.sql
select * from {{ ref('finance_model') }}
$ dbt run -s marketing_model
...
dbt.exceptions.DbtReferenceError: Parsing Error
Node model.jaffle_shop.marketing_model attempted to reference node model.jaffle_shop.finance_model,
which is not allowed because the referenced node is private to the finance group.
0