SHOW GRANTS

statementsupportedAccess control (grants, roles)

docs.snowflake.com ↗

Lists all access control privileges that have been explicitly granted to roles, users, and shares. For more information about privileges and roles, refer to Overview of Access Control. For more information about shares, refer to About Secure Data Sharing. Note SHOW GRANTS is a special variation that uses different syntax from all the other SHOW <objects> commands.

Syntax

supportedpartialnot supportednot scored

SHOW GRANTS [ LIMIT <rows> ]

SHOW GRANTS ON ACCOUNT [ LIMIT <rows> ]

SHOW GRANTS ON <object_type> <object_name> [ LIMIT <rows> ]

SHOW GRANTS TO {
  APPLICATION <app_name>
  | APPLICATION ROLE [ <app_name>. ]<app_role_name>
  | SERVICE ROLE <service_name>!<service_role_name>
  | <class_name> ROLE <instance_name>!<instance_role_name>
  | SHARE <share_name> [ IN APPLICATION PACKAGE <app_package_name> ]
} [ LIMIT <rows> ]

SHOW GRANTS TO {
  DATABASE ROLE <database_role_name>
  | ROLE <role_name>
  | USER <user_name>
} [ INCLUDE HIERARCHY ] [ LIMIT <rows> ]

SHOW GRANTS OF {
  APPLICATION ROLE <app_role_name>
  | SERVICE ROLE <service_name>!<service_role_name>
  | ROLE <role_name>
} [ LIMIT <rows> ]

SHOW GRANTS OF SHARE <share_name> [ LIMIT <rows> ]

SHOW FUTURE GRANTS IN SCHEMA { <schema_name> } [ LIMIT <rows> ]

SHOW FUTURE GRANTS IN DATABASE { <database_name> } [ LIMIT <rows> ]

SHOW FUTURE GRANTS TO ROLE <role_name> [ INCLUDE HIERARCHY ] [ LIMIT <rows> ]

SHOW FUTURE GRANTS TO DATABASE ROLE <database_role_name> [ INCLUDE HIERARCHY ] [ LIMIT <rows> ]

Parameters

NameRequiredDescription
SHOW GRANTSSyntactically equivalent to SHOW GRANTS TO USER current_user. Lists all the roles granted to the current user.
LIMIT rowsOptionally limits the maximum number of rows returned. The actual number of rows returned might be less than the specified limit. For example, the number of existing objects is less than the specified limit. Default: No value (no limit is applied to the output).
SHOW GRANTS ON ...
ACCOUNTLists all the account-level (i.e. global) privileges that have been granted to roles.
object_type object_nameLists all privileges that have been granted on the object. For database roles, you can use the fully qualified name, database_name.database_role_name, or the relative name, database_role_name. If you use the relative name for the database role, Snowflake uses the database in session to resolve the relative name of the database role.
SHOW GRANTS TO ...
APPLICATION app_nameLists all the privileges and roles granted to the application.
APPLICATION ROLE [ app_name. ]app_role_nameLists all the privileges and roles granted to the application role. The name of the application, app_name, is optional. If not specified, Snowflake uses the current application. If the application is not a database, this command does not return results.
SERVICE ROLE service_name!service_role_nameLists the service endpoints for which the service role is granted the USAGE privilege.
class_name ROLE instance_name!instance_role_nameLists all the privileges and roles granted to the instance role. If the database and schema that contains the class_name is not in use or is not specified in your search path, specify the fully-qualified name of the class. For example, SNOWFLAKE.CORE.BUDGET. For details, see the instance role example.
DATABASE ROLE database_role_nameLists all privileges and roles granted to the database role.
ROLE role_nameLists all privileges and roles granted to the role. If the role has a grant on a temporary object, then the grant only exists in the session that the temporary object was created. SHOW GRANTS TO ROLE PUBLIC exposes the following irrevocable database roles granted to the public role: ALERT_VIEWER CLASSIFICATION_VIEWER CORE_VIEWER DATA_PRIVACY_VIEWER ML_USER MONITORING_VIEWER NOTIFICATION_VIEWER SNOWFLAKE_TEMPLATE_SNOWGIT_VIEWER SPCS_REGISTRY_VIEWER
SHARE share_nameLists all the privileges granted to the share.
SHARE share_name IN APPLICATION PACKAGE app_package_nameLists all of the privileges and roles granted to a share in the application package.
USER user_nameLists all the roles granted to the user. Note that the PUBLIC role, which is automatically available to every user, is not listed.
INCLUDE HIERARCHYExpands the role hierarchy for the specified grantee and lists the grants held by every role in that hierarchy. For grants held by a role, grantee_name identifies that role, including when the role is granted directly or indirectly to the role or user you specified. You can specify INCLUDE HIERARCHY only with DATABASE ROLE, ROLE, or USER. See the usage notes for the grantees that fail and for grants that the expansion omits. The expanded hierarchy includes the following: The specified role, or the roles granted to the specified user. Account roles, database roles, and application roles granted to those roles, recursively. The account-level PUBLIC role. The expansion does not list grants held by instance roles, service roles, or class roles. Role-membership grants of those roles to an account role still appear. For SHOW GRANTS TO USER, the output includes the user’s role-membership rows and the privileges granted directly to the user, with or without this clause. With this clause, it also includes the grants held by each role in the user’s hierarchy. For the user’s own rows, grantee_name identifies the user. The grants listed for each account role or database role in the hierarchy match the output of SHOW GRANTS TO ROLE (or SHOW GRANTS TO DATABASE ROLE) for that role.
SHOW GRANTS OF...
APPLICATION ROLE [ app_name. ]app_roleLists all the users and roles to which the application role has been granted. The name of the application, app_name, is optional. If not specified, Snowflake uses the current application. If the application is not a database, this command does not return results.
SERVICE ROLE service_name!service_role_nameLists all the users and roles to which the service role has been granted.
ROLE role_nameLists all users and roles to which the role has been granted.
SHARE share_nameLists all the accounts that are consuming the share. Accounts that have not yet consumed the share are excluded. To see all accounts that have been added to a share, query the SNOWFLAKE.ACCOUNT_USAGE.SHARES view.
SHOW FUTURE GRANTS IN ...
SCHEMA database_name.schema_nameLists all privileges on new (i.e. future) objects of a specified type in the schema granted to a role. database_name. specifies the database in which the schema resides and is optional when querying a schema in the current database.
DATABASE database_nameLists all privileges on new (i.e. future) objects of a specified type in the database granted to a role.
SHOW FUTURE GRANTS TO ROLE role_nameLists all privileges on new (i.e. future) objects of a specified type in a database or schema granted to the role. Specify INCLUDE HIERARCHY to also list future grants held by every account role, database role, and application role in the specified role’s hierarchy, including the account-level PUBLIC role. Each row’s grantee_name is the role that holds the future grant. Future grants held by instance roles, service roles, or class roles are omitted. See the usage notes.
SHOW FUTURE GRANTS TO DATABASE ROLE database_role_nameLists all privileges on new (i.e. future) objects of a specified type in a database or schema granted to the database role. Specify INCLUDE HIERARCHY to also list future grants held by every account role, database role, and application role in the specified database role’s hierarchy, including the account-level PUBLIC role. Each row’s grantee_name is the role that holds the future grant. Future grants held by instance roles, service roles, or class roles are omitted. See the usage notes. A shared database role does not support future grants. For details, see the usage notes in the GRANT DATABASE ROLE … TO SHARE command.

Usage notes

Referenced by