Model groups
Groups
Models can be grouped under a common designation with a shared owner. For example, you could group together all models owned by a particular team, or related to modeling a specific data source (hubspot
).
Groups transforms implicit relationships into explicit groupings with a defined owner. By defining interface boundaries between groups, you can create a cleaner, less entangled DAG.
This approach allows you to designate certain models as having "private" access, intended for exclusive use within that group. Other models will be restricted from referencing or depending on these private models. Eventually, these private models won't be visible to other teams relying on your project—only the "public" models will be accessible.
A group is a collection of nodes within a dbt DAG. Groups are named, and every group has an owner
. They enable intentional collaboration within and across teams by restricting access to private models.
Group members may include models, tests, seeds, snapshots, analyses, and metrics. (Not included: sources and exposures.) Each node may belong to only one group.
Declaring a group
Groups are defined in .yml
files, nested under a groups:
key.
Adding a model to a group
Use the group
configuration to add one or more models to a group.
Referencing a model in a group
By default, all models within a group have the protected
access modifier. This means they can be referenced by downstream resources in any group in the same project, using the ref
function. If a grouped model's access
property is set to private
, only resources within its group can reference it.
Each model can only belong to one group
, and groups cannot be nested. If you set a different group
in that model's YAML or in-file config, it will override the group
applied at the project level.
Last updated