79419509

Date: 2025-02-06 22:33:01
Score: 1
Natty:
Report link

The best I have without writing a sproc is manumatic.

  1. run this query:

    select distinct grantee_name from snowflake.account_usage.grants_to_roles where granted_on='WAREHOUSE' and NAME= and privilege ='USAGE' ;

  2. Copy to Excel

  3. in Cells B1, B2 enter these formulas B1 =

    SELECT grantee_name FROM snowflake.account_usage.grants_to_users WHERE role in('" &A1&"'," B2 =B1&"'"&A2&"',"

Copy cell B2 down to the last row with a role name in column A Copy the Statment from the last row Fix the end of that statement before running - remove the last , and add a );

I could write this in a stored procedure but will have to try that later.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Dan Greenberg