group
- Models
- Seeds
- Snapshots
- Tests
- Analyses
- Metrics
- Semantic models
- Saved queries
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 ...
dbt_project.yml
models:
<resource-path>:
+group: GROUP_NAME
seeds/properties.yml
seeds:
- name: [SEED_NAME]
group: GROUP_NAME
dbt_project.yml
snapshots:
<resource-path>:
+group: GROUP_NAME
snapshots/<filename>.sql
{% snapshot snapshot_name %}
{{ config(
group='GROUP_NAME'
) }}
select ...
{% endsnapshot %}
dbt_project.yml
tests:
<resource-path>:
+group: GROUP_NAME
tests/properties.yml
version: 2
<resource_type>:
- name: <resource_name>
tests:
- <test_name>:
config:
group: GROUP_NAME
tests/<filename>.sql
{% test <testname>() %}
{{ config(
group='GROUP_NAME'
) }}
select ...
{% endtest %}
tests/<filename>.sql
{{ config(
group='GROUP_NAME'
) }}
analyses/<filename>.yml
version: 2
analyses:
- name: ANALYSIS_NAME
group: GROUP_NAME
dbt_project.yml
metrics:
<resource-path>:
+group: GROUP_NAME
models/metrics.yml
version: 2
metrics:
- name: [METRIC_NAME]
config:
group: GROUP_NAME
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.
Related docs
0