Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I list all of a user's roles in snowflake DB?

Is it possible to list all of the roles that a user has access to in Snowflake DB?

I seem to be able to show the users with access to a role but I can't figure out how to list the roles a user is granted. Of course I can crawl the roles and work at it from that angle, but it would be very beneficial to do the opposite.

like image 777
John Humphreys Avatar asked Mar 06 '19 21:03

John Humphreys


People also ask

How do you check all roles in a Snowflake?

Lists all the roles which you can view across your entire account, including the system-defined roles and any custom roles that exist. Snowflake allows users to list roles; however, the ability to list roles is not the same as using any role. Knowing the names of roles does not allow any additional access.

How do you find the current role in a Snowflake?

Returns the name of the primary role in use for the current session. To specify a different role for the session, execute the USE ROLE command.

Which system role manages the users and roles in Snowflake?

The SYSADMIN role is a system-defined role that has privileges to create warehouses, databases, and database objects in an account and grant those privileges to other roles. In the default system hierarchy, the top-level ACCOUNTADMIN role manages the system administrator role.

How many roles can a user have in Snowflake?

The roles must be granted to the user before they can be activated in a session. Note that while a session must have exactly one active primary role at a time, one can activate any number of secondary roles at the same time.


1 Answers

It turns out that:

show grants to user <user-name>;

Actually lists the roles of the user very trivially. I had tried this before and miss-read the output and ended up wasting a lot of time looking for alternatives.

like image 169
John Humphreys Avatar answered Sep 22 '22 05:09

John Humphreys