Created
August 19, 2020 01:50
-
-
Save sgoley/0498b1d555882b557eb9f2ca6139c552 to your computer and use it in GitHub Desktop.
dbt macro to grant select usage and select for all tables of a schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro grant_select_on_schemas(schemas, user) %} | |
{% for schema in schemas %} | |
grant usage on schema {{ schema }} to "{{ user }}"; | |
grant select on all tables in schema {{ schema }} to "{{ user }}"; | |
alter default privileges in schema {{ schema }} | |
grant select on tables to "{{ user }}"; | |
{% endfor %} | |
{% endmacro %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment