SHOW ROLES

statementsupportedAccess control (grants, roles)

docs.snowflake.com ↗

Object: ROLE

Lists all the roles which you can view across your entire account, including the system-defined roles and any custom roles that exist. Important 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. This is a part of Discretionary Access Control and Role-Based Access Control. For more information, see Overview of Access Control.

Syntax

supportedpartialnot supportednot scored

SHOW [ TERSE ] ROLES
  [ LIKE '<pattern>' ]
  [ IN CLASS <class_name> ]
  [ STARTS WITH '<name_string>']
  [ LIMIT <rows> [ FROM '<name_string>' ] ]

Parameters

NameRequiredDescription
TERSEReturns only a subset of columns:
  • is_default — Specifies whether the role used to run the command is the user’s default role.
  • is_current — Specifies whether the role used to run the command is the user’s current role.
  • is_inherited — Specifies whether the role used to run the command inherits the specified role.
  • is_from_organization_user_group — If TRUE, the role was imported from an organization user group.
LIKE 'pattern'Optionally filters the command output by object name. The filter uses case-insensitive pattern matching, with support for SQL wildcard characters (% and _). For example, the following patterns return the same results: ... LIKE '%testing%' ... ... LIKE '%TESTING%' ... Default: No value (no filtering is applied to the output).
IN CLASS class_nameReturns records for the specified class (class_name).
STARTS WITH 'name_string'Optionally filters the command output based on the characters that appear at the beginning of the object name. The string must be enclosed in single quotes and is case sensitive. For example, the following strings return different results: ... STARTS WITH 'B' ... ... STARTS WITH 'b' ... Default: No value (no filtering is applied to the output)
LIMIT rows [ FROM 'name_string' ]Optionally limits the maximum number of rows returned, while also enabling “pagination” of the results. 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. The optional FROM 'name_string' subclause effectively serves as a “cursor” for the results. This enables fetching the specified number of rows following the first row whose object name matches the specified string: The string must be enclosed in single quotes and is case sensitive. The string does not have to include the full object name; partial names are supported. Default: No value (no limit is applied to the output) Note For SHOW commands that support both the FROM 'name_string' and STARTS WITH 'name_string' clauses, you can combine both of these clauses in the same statement. However, both conditions must be met or they cancel out each other and no results are returned. In addition, objects are returned in lexicographic order by name, so FROM 'name_string' only returns rows with a higher lexicographic value than the rows returned by STARTS WITH 'name_string'. For example: ... STARTS WITH 'A' LIMIT ... FROM 'B' would return no results. ... STARTS WITH 'B' LIMIT ... FROM 'A' would return no results. ... STARTS WITH 'A' LIMIT ... FROM 'AB' would return results (if any rows match the input strings).

Usage notes

See also

Referenced by