Skip to main content

group

dbt_project.yml
models:

<resource-path>:
+group: GROUP_NAME

models/schema.yml
version: 2

models:
- name: MODEL_NAME
group: GROUP

models/<modelname>.sql

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

select ...

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
access: private
group: finance
- name: marketing_model
group: marketing
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