Skip to content

Commit 4e7558c

Browse files
Enhance grant_internal_share_read macro to include schema usage grants
1 parent ae50122 commit 4e7558c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

macros/grants/grant_internal_share_read.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
{% set schemas = dbt_dataengineers_utils._grants_collect_schemas(exclude_schemas) %}
1313
{% do log("Granting SELECT on all tables and views in all schemas for share: " ~ share_name ~ " (dry_run=" ~ dry_run ~ ")", info=True) %}
1414
{% for schema in schemas %}
15+
{% set grant_usage %}
16+
grant usage on schema {{ database }}.{{ schema }} to share {{ share_name }};
17+
{% endset %}
18+
{% if dry_run %}
19+
{% do log(grant_usage, info=True) %}
20+
{% else %}
21+
{% do run_query(grant_usage) %}
22+
{% endif %}
1523
{# Grant SELECT on all tables in schema #}
1624
{% set grant_tables_sql %}
1725
grant select on all tables in schema {{ database }}.{{ schema }} to share {{ share_name }};

0 commit comments

Comments
 (0)