I'm trying to write SELECT statements that would generate 'grant' scripts that would grant all the privs to the appropriate roles in the entire account.
This is needed to migrate a Snowflake account from one region to another.
Has anyone come up with such a script ?
I have the following so far (runs ok, but its not validated yet,too many rows,perhaps its a cartesian product) :
select 'grant ' || gt.privilege || ' on ' || GT.TABLE_CATALOG || '.' || gt.table_schema || '.' || gt.granted_on || ' ' || gt.name || ' to role ' || gt.grantee_name || ';' from account_usage.grants_to_roles gt
where gt.table_catalog IS NOT NULL and gt.table_schema IS NOT NULL order by gt.grantee_name, gt.name, gt.granted_on,gt.privilege
Thanks
NJ_JA