From b27c5f3a0c456e61f7e10e7320563c8df5a86ce7 Mon Sep 17 00:00:00 2001 From: Fraser Barton Date: Tue, 10 Oct 2023 19:34:36 +0100 Subject: [PATCH 1/2] Add grant/revoke quotes --- .../global_project/macros/adapters/apply_grants.sql | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/dbt/include/global_project/macros/adapters/apply_grants.sql b/core/dbt/include/global_project/macros/adapters/apply_grants.sql index 10906e7ffa7..66b617264ad 100644 --- a/core/dbt/include/global_project/macros/adapters/apply_grants.sql +++ b/core/dbt/include/global_project/macros/adapters/apply_grants.sql @@ -70,7 +70,11 @@ {% endmacro %} {%- macro default__get_grant_sql(relation, privilege, grantees) -%} - grant {{ privilege }} on {{ relation }} to {{ grantees | join(', ') }} + grant {{ privilege }} on {{ relation }} to + {% for grantee in grantees %} + {{ adapter.quote(grantee) }} + {% if not loop.last %},{% endif %} + {% endfor %} {%- endmacro -%} @@ -79,7 +83,11 @@ {% endmacro %} {%- macro default__get_revoke_sql(relation, privilege, grantees) -%} - revoke {{ privilege }} on {{ relation }} from {{ grantees | join(', ') }} + revoke {{ privilege }} on {{ relation }} from + {% for grantee in grantees %} + {{ adapter.quote(grantee) }} + {% if not loop.last %},{% endif %} + {% endfor %} {%- endmacro -%} From bdeec2484a585802888aed2066ae2060f1cafa99 Mon Sep 17 00:00:00 2001 From: Fraser Barton Date: Tue, 10 Oct 2023 19:35:38 +0100 Subject: [PATCH 2/2] changie --- .changes/unreleased/Fixes-20231010-193527.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixes-20231010-193527.yaml diff --git a/.changes/unreleased/Fixes-20231010-193527.yaml b/.changes/unreleased/Fixes-20231010-193527.yaml new file mode 100644 index 00000000000..960970e842e --- /dev/null +++ b/.changes/unreleased/Fixes-20231010-193527.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Add quotes to usernames when revoking and granting table permissions +time: 2023-10-10T19:35:27.223761+01:00 +custom: + Author: barton996 + Issue: 6444 8751