Course contentsShow
← Data Engineering
Lesson 348 of 8255. Batch ETL/ELT Pipelines with dbtFree lesson

Managing Metadata with Custom Tags and Groups

Apply organizational tags and resource groups to models to improve project navigation and control access permissions for specific data domains.

In this lesson, you’ll learn how to organize your dbt project by applying custom tags and resource groups to models for improved navigation and access control.

As your dbt project grows from a few models to hundreds, finding specific tables and managing who can access them becomes a challenge. By using metadata, you can categorize your models beyond just their file path.

Custom Tags

Tags are labels you attach to your models within the config block. They act like sticky notes that help you filter your project. For example, you might want to tag models by their business domain (e.g., marketing, finance) or by their performance profile (e.g., hourly, nightly).

You can apply these in your dbt_project.yml or directly inside the model file:

{{ config(
    tags=['finance', 'critical_path']
) }}

select * from {{ ref('stg_transactions') }}

Once tagged, you can run commands like dbt run --select tag:finance to build only the models related to the finance department, or use these tags in your documentation site to filter for specific business areas.

Resource Groups

While tags help with organization and execution, groups are primarily used for managing access permissions. A group represents a logical collection of models that share the same owner or security policy. By assigning a model to a group, you define the "boundary" for that data.

You define groups in your dbt_project.yml file and then assign models to them:

# dbt_project.yml
models:
  my_project:
    finance:
      +group: finance_team

When you assign a model to the finance_team group, you can restrict access to these resources in your data warehouse, ensuring that only users with the correct roles can interact with sensitive financial tables. This creates a clean "contract" between your dbt project and your warehouse security settings, making it much easier to govern data access at scale.

Key Takeaway: Use tags to slice and organize your model execution, and use groups to enforce clear ownership and security boundaries across your data domains.