Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20240625-140329.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fix grants statements on materialized views
time: 2024-06-25T14:03:29.437827546Z
custom:
Author: AcidFlow
Issue: "1268"
14 changes: 12 additions & 2 deletions dbt/include/bigquery/macros/adapters/apply_grants.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,19 @@


{%- macro bigquery__get_grant_sql(relation, privilege, grantee) -%}
grant `{{ privilege }}` on {{ relation.type }} {{ relation }} to {{ '\"' + grantee|join('\", \"') + '\"' }}
{% set relation_type_overrides = {
"materialized_view": "materialized view"
}
%}
{% set relation_type = relation_type_overrides.get(relation.type, relation.type) %}
grant `{{ privilege }}` on {{ relation_type }} {{ relation }} to {{ '\"' + grantee|join('\", \"') + '\"' }}
{%- endmacro -%}

{%- macro bigquery__get_revoke_sql(relation, privilege, grantee) -%}
revoke `{{ privilege }}` on {{ relation.type }} {{ relation }} from {{ '\"' + grantee|join('\", \"') + '\"' }}
{% set relation_type_overrides = {
"materialized_view": "materialized view"
}
%}
{% set relation_type = relation_type_overrides.get(relation.type, relation.type) %}
revoke `{{ privilege }}` on {{ relation_type }} {{ relation }} from {{ '\"' + grantee|join('\", \"') + '\"' }}
{%- endmacro -%}
Loading