Created
December 8, 2021 11:35
-
-
Save louisdorard/0c89a21719d7f2870f78441b2780f5d7 to your computer and use it in GitHub Desktop.
Script to grant Dataiku read access to all tables in a given schema in Snowflake
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
begin; | |
-- create variables for dataiku role and for database / schema where the tables are (needs to be uppercase for objects) | |
set role_name = 'DATAIKU_ROLE'; | |
set database_name = 'FIVETRAN_DATABASE'; | |
set schema_name = 'STRIPE'; | |
use role sysadmin; | |
-- grant dataiku access to database | |
grant USAGE | |
on database identifier($database_name) | |
to role identifier($role_name); | |
-- grant dataiku access to schema | |
use database identifier($database_name); | |
grant USAGE | |
on schema identifier($schema_name) | |
to role identifier($role_name); | |
-- grant dataiku access to tables in schema | |
grant SELECT | |
on all tables in schema identifier($schema_name) | |
to role identifier($role_name); | |
commit; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment