Granting model access through the grants config
The grants config lets you manage access permissions on the objects dbt creates for a model directly within your dbt project, keeping access control version-controlled and consistent across environments. Grants are typically applied in dbt_project.yml or a model's config block and are supported by adapters like Snowflake, BigQuery, Redshift, and Databricks. dbt applies grants after the model builds by running the appropriate GRANT statements on your platform.
1 · Learn the must-know
- Grants are configured as a dictionary where keys are privileges (e.g., select) and values are lists of grantees (users, roles, or groups).
- By default, dbt runs in 'apply grants' mode, meaning it will add missing grants and revoke grants not specified in the config to keep the object's permissions in sync with what's defined.
- You can set
copy_grants(Snowflake-specific) or manage revocation behavior to control whether existing grants persist across model rebuilds. - Grants can be set at the project level in
dbt_project.yml(applying broadly), or overridden at the individual model level in a config() block or YAML properties file. - Grants only apply to database objects that dbt creates or replaces (tables, views); they do not affect seeds, snapshots differently, or objects outside dbt's control.
- Not all adapters support all grant privileges or grantee types identically, so grant syntax and supported privileges can vary by warehouse (e.g., Snowflake roles vs. Redshift users/groups).
2 · Check your understanding
A model file models/marts/finance/fct_orders.sql contains this config block:
{{
config(
materialized='table',
grants={
'select': ['analyst_role', 'bi_tool_role']
}
)
}}
When you run dbt run --select fct_orders, what does dbt do after building the table?
What you have tried across dbt Analytics Engineering's objectives, not a readiness score.
Developing and optimizing dbt models45.16% of the exam*0 of 14 tried
Managing dbt models governance9.68% of the exam*0 of 3 tried
Debugging data modeling errors16.13% of the exam*0 of 5 tried
Troubleshooting and optimizing dbt pipelines6.45% of the exam*0 of 2 tried
Implementing dbt tests9.68% of the exam*0 of 3 tried
Implementing and maintaining external dependencies6.45% of the exam*0 of 2 tried
Leveraging the dbt state6.45% of the exam*0 of 2 tried
* Our estimate. dbt Labs publishes no section weights.
3 · Keep going
Ready for more? Take a weighted mock or try free practice questions.