Configure dbt model-level and project-level grants to manage warehouse access control alongside dbt materializations

domain: docs.getdbt.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Define grants in dbt_project.yml at the project level under models: with grants: {select: ['role_name']} to apply a default GRANT SELECT to all materialized models; override at the model level with {{ config(grants={'select': ['reporting_role']}) }}
  2. dbt applies GRANT statements after each model materializes; for table and incremental materializations this is after the full table is created or updated; for views dbt re-applies grants each run since views are recreated
  3. Use {{ env_var('DBT_GRANT_ROLE') }} in the grants configuration to parameterize role names per environment, so dev grants differ from production grants without code changes
  4. For incremental models on warehouses that recreate the table on --full-refresh, dbt re-grants after full refresh; verify that your grants configuration is idempotent and does not accumulate duplicate grants
  5. Test that grants are applied correctly by querying the warehouse's information_schema.role_table_grants or equivalent after a dbt run and confirming the expected roles have SELECT on the materialized models

Known gotchas

Related routes

Configure dbt Cloud Semantic Layer access control by mapping service tokens to separate warehouse credentials for different teams
docs.getdbt.com · 5 steps · unrated
Use dbt pre-hook and post-hook to manage warehouse grants and housekeeping SQL around model builds
docs.getdbt.com · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans