A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/developer-guide/python-connector/../../sql-reference/sql/show-grants below:

Website Navigation


SHOW GRANTS | Snowflake Documentation

SHOW GRANTS

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
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>
  | ROLE <role_name>
  | SHARE <share_name> [ IN APPLICATION PACKAGE <app_package_name> ]
  | USER <user_name>
} [ 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> [ LIMIT <rows> ]

SHOW FUTURE GRANTS TO DATABASE ROLE <database_role_name>

Copy

Variants
SHOW GRANTS

Syntactically equivalent to SHOW GRANTS TO USER current_user. Lists all the roles granted to the current user.

LIMIT rows

Optionally 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 ...
ACCOUNT

Lists all the account-level (i.e. global) privileges that have been granted to roles.

object_type object_name

Lists 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_name

Lists all the privileges and roles granted to the application.

APPLICATION ROLE [ app_name. ]app_role_name

Lists 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_name

Lists the service endpoints for which the service role is granted the USAGE privilege.

class_name ROLE instance_name!instance_role_name

Lists 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.

ROLE role_name

Lists 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_name

Lists all the privileges granted to the share.

SHARE share_name IN APPLICATION PACKAGE app_package_name

Lists all of the privileges and roles granted to a share in the application package.

USER user_name

Lists all the roles granted to the user. Note that the PUBLIC role, which is automatically available to every user, is not listed.

SHOW GRANTS OF...
APPLICATION ROLE [ app_name. ]app_role

Lists 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_name

Lists all the users and roles to which the service role has been granted.

ROLE role_name

Lists all users and roles to which the role has been granted.

SHARE share_name

Lists 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_name

Lists 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_name

Lists 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_name

Lists all privileges on new (i.e. future) objects of a specified type in a database or schema granted to the role.

SHOW FUTURE GRANTS TO DATABASE ROLE database_role_name

Lists all privileges on new (i.e. future) objects of a specified type in a database or schema granted to the database role.

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 Examples

List all privileges that have been granted on the sales database:

SHOW GRANTS ON DATABASE sales;

Copy

+---------------------------------+-----------+------------+------------+------------+--------------+--------------+----------------------+--------------+
| created_on                      | privilege | granted_on | name       | granted_to | grantee_name | grant_option | granted_by_role_type | granted_by   |
+---------------------------------+-----------+------------+------------+------------+--------------+--------------+----------------------+--------------+
| Thu, 07 Jul 2016 05:22:29 -0700 | OWNERSHIP | DATABASE   | REALESTATE | ROLE       | ACCOUNTADMIN | true         | ROLE                 | ACCOUNTADMIN |
| Thu, 07 Jul 2016 12:14:12 -0700 | USAGE     | DATABASE   | REALESTATE | ROLE       | PUBLIC       | false        | ROLE                 | ACCOUNTADMIN |
+---------------------------------+-----------+------------+------------+------------+--------------+--------------+----------------------+--------------+

List all privileges granted to the analyst role:

SHOW GRANTS TO ROLE analyst;

Copy

+---------------------------------+------------------+------------+------------+------------+--------------+--------------+------------+
| created_on                      | privilege        | granted_on | name       | granted_to | grantee_name | grant_option | granted_by |
|---------------------------------+------------------+------------+------------+------------+--------------+--------------+------------+
| Wed, 17 Dec 2014 18:19:37 -0800 | CREATE WAREHOUSE | ACCOUNT    | DEMOENV    | ROLE       |  ANALYST     | false        | SYSADMIN   |
+---------------------------------+------------------+------------+------------+------------+--------------+--------------+------------+

List all privileges granted to the public role:

SHOW GRANTS TO ROLE public;

Copy

(example trimmed to show only the irrevocable database roles granted to the public role)

+---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------+
| created_on                      | privilege | granted_on    | name                              | granted_to | grantee_name | grant_option | granted_by |
|---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------|
| ...                             |           |               |                                   |            |              |              |            |
|---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------+
| 2023-08-18 13:33:01.156 -0700   | USAGE     | DATABASE_ROLE | ALERT_VIEWER                      | ROLE       | PUBLIC       | false        |            |
+---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------+
| 2023-08-18 13:33:01.156 -0700   | USAGE     | DATABASE_ROLE | CLASSIFICATION_VIEWER             | ROLE       | PUBLIC       | false        |            |
+---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------+
| 2023-08-18 13:33:01.156 -0700   | USAGE     | DATABASE_ROLE | CORE_VIEWER                       | ROLE       | PUBLIC       | false        |            |
+---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------+
| 2023-08-18 13:33:01.156 -0700   | USAGE     | DATABASE_ROLE | DATA_PRIVACY_VIEWER               | ROLE       | PUBLIC       | false        |            |
+---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+-------- -----+------------+
| 2023-08-18 13:33:01.156 -0700   | USAGE     | DATABASE_ROLE | ML_USER                           | ROLE       | PUBLIC       | false        |            |
+---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------+
| 2023-08-18 13:33:01.156 -0700   | USAGE     | DATABASE_ROLE | MONITORING_VIEWER                 | ROLE       | PUBLIC       | false        |            |
+---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------+
| 2023-08-18 13:33:01.156 -0700   | USAGE     | DATABASE_ROLE | NOTIFICATION_VIEWER               | ROLE       | PUBLIC       | false        |            |
+---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------+
| 2023-08-18 13:33:01.156 -0700   | USAGE     | DATABASE_ROLE | SNOWFLAKE_TEMPLATE_SNOWGIT_VIEWER | ROLE       | PUBLIC       | false        |            |
+---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------+
| 2023-08-18 13:33:01.156 -0700   | USAGE     | DATABASE_ROLE | SPCS_REGISTRY_VIEWER              | ROLE       | PUBLIC       | false        |            |
+---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------+
| ...                             |           |               |                                   |            |              |              |            |
+---------------------------------+-----------+---------------+-----------------------------------+------------+--------------+--------------+------------+

List all the roles granted to the user1 user:

SHOW GRANTS TO USER user1;

Copy

+-------------------------------+-----------+------------+---------------------------+-----------+------------+--------------+--------------+---------------+
| created_on                    | privilege | granted_on | name                      |  role     | granted_to | grantee_name | grant_option | granted_by    |
|-------------------------------+-----------+------------+---------------------------+-----------+------------+--------------+------------------------------|
| 2025-05-07 09:08:43.773 -0800 | USAGE     | DATABASE   | test_db                   | null      | USER       | user1        | false        | SECURITYADMIN |
| 2025-05-07 09:08:55.253 -0800 | USAGE     | SCHEMA     | test_db.test_sch          | null      | USER       | user1        | false        | SECURITYADMIN |
| 2025-05-07 09:08:55.253 -0800 | SELECT    | TABLE      | test_db.test_sch.test_tbl | null      | USER       | user1        | false        | SECURITYADMIN |
| 2025-05-07 09:08:34.838 -0800 | USAGE     | WAREHOUSE  | test_wh                   | null      | USER       | user1        | false        | SECURITYADMIN |
+-------------------------------+-----------+------------+---------------------------+-----------+------------+--------------+--------------+---------------+

List all roles and users who have been granted the analyst role:

SHOW GRANTS OF ROLE analyst;

Copy

+---------------------------------+---------+------------+--------------+---------------+
| created_on                      | role    | granted_to | grantee_name | granted_by    |
|---------------------------------+---------+------------+--------------+---------------|
| Tue, 05 Jul 2016 16:16:34 -0700 | ANALYST | ROLE       | ANALYST_US   | SECURITYADMIN |
| Tue, 05 Jul 2016 16:16:34 -0700 | ANALYST | ROLE       | DBA          | SECURITYADMIN |
| Fri, 08 Jul 2016 10:21:30 -0700 | ANALYST | USER       | JOESM        | SECURITYADMIN |
+---------------------------------+---------+------------+--------------+---------------+

List all privileges granted on future objects in the sales.public schema:

SHOW FUTURE GRANTS IN SCHEMA sales.public;

Copy

+-------------------------------+-----------+----------+---------------------------+----------+-----------------------+--------------+
| created_on                    | privilege | grant_on | name                      | grant_to | grantee_name          | grant_option |
|-------------------------------+-----------+----------+---------------------------+----------+-----------------------+--------------|
| 2018-12-21 09:22:26.946 -0800 | INSERT    | TABLE    | SALES.PUBLIC.<TABLE>      | ROLE     | ROLE1                 | false        |
| 2018-12-21 09:22:26.946 -0800 | SELECT    | TABLE    | SALES.PUBLIC.<TABLE>      | ROLE     | ROLE1                 | false        |
+-------------------------------+-----------+----------+---------------------------+----------+-----------------------+--------------+

List all roles privileges granted to the instance role named cost.budgets.my_budget!ADMIN:

SHOW GRANTS TO SNOWFLAKE.CORE.BUDGET ROLE cost.budgets.my_budget!ADMIN;

Copy

+-------------------------------+-----------+------------+----------------------------------------------------------------------------------------------------------------------------------------+
| created_on                    | privilege | granted_on | name                                                                                                                                   |
+-------------------------------+-----------+------------+----------------------------------------------------------------------------------------------------------------------------------------+
| 2023-10-31 15:57:41.489 +0000 | USAGE     | ROLE       | SNOWFLAKE.CORE.BUDGET!ADMIN                                                                                                            |
| 2023-09-25 22:56:12.798 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!ACTIVATE():VARCHAR(16777216)                                                                                     |
| 2023-09-25 22:56:13.304 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!ADD_RESOURCE(TARGET_REF VARCHAR):VARCHAR(16777216)                                                               |
| 2023-09-25 22:56:12.863 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_ACTIVATION_DATE():DATE                                                                                       |
| 2023-09-25 22:56:12.412 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_BUDGET_NAME():VARCHAR(16777216)                                                                              |
| 2023-09-25 22:56:11.510 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_CONFIG():TABLE: ()                                                                                           |
| 2023-09-25 22:56:13.432 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_LINKED_RESOURCES():TABLE: ()                                                                                 |
| 2023-09-25 22:56:11.582 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_MEASUREMENT_TABLE():TABLE: ()                                                                                |
| 2023-09-25 22:56:12.153 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_NOTIFICATION_EMAIL():VARCHAR(16777216)                                                                       |
| 2023-09-25 22:56:12.016 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_NOTIFICATION_INTEGRATION_NAME():VARCHAR(16777216)                                                            |
| 2023-09-25 22:56:12.286 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_NOTIFICATION_MUTE_FLAG():VARCHAR(16777216)                                                                   |
| 2023-09-25 22:56:13.068 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_SERVICE_TYPE_USAGE(SERVICE_TYPE VARCHAR):TABLE: ()                                                           |
| 2023-09-25 22:56:13.245 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_SERVICE_TYPE_USAGE(SERVICE_TYPE VARCHAR, TIME_DEPART VARCHAR, USER_TIMEZONE VARCHAR, TIME_LOWER_BOUND VARCHA |
| 2023-09-25 22:56:12.595 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_SPENDING_HISTORY():TABLE: ()                                                                                 |
| 2023-09-25 22:56:12.732 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_SPENDING_HISTORY(TIME_LOWER_BOUND VARCHAR, TIME_UPPER_BOUND VARCHAR):TABLE: ()                               |
| 2023-09-25 22:56:11.716 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!GET_SPENDING_LIMIT():NUMBER(38,0)                                                                                |
| 2023-09-25 22:56:13.367 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!REMOVE_RESOURCE(TARGET_REF VARCHAR):VARCHAR(16777216)                                                            |
| 2023-09-25 22:56:11.856 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!SET_EMAIL_NOTIFICATIONS(NOTIFICATION_CHANNEL_NAME VARCHAR, EMAIL VARCHAR):VARCHAR(16777216)                      |
| 2023-09-25 22:56:12.349 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!SET_NOTIFICATION_MUTE_FLAG(USER_MUTE_FLAG BOOLEAN):VARCHAR(16777216)                                             |
| 2023-09-25 22:56:11.780 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!SET_SPENDING_LIMIT(SPENDING_LIMIT FLOAT):VARCHAR(16777216)                                                       |
| 2023-09-25 22:56:12.475 +0000 | USAGE     | PROCEDURE  | SNOWFLAKE.CORE.BUDGET!SET_TASK_SCHEDULE(NEW_SCHEDULE VARCHAR):VARCHAR(16777216)                                                        |
+-------------------------------+-----------+------------+----------------------------------------------------------------------------------------------------------------------------------------+

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4