Skip to main content

grants_to

Creates, updates, deletes, gets or lists a grants_to resource.

Overview

Namegrants_to
TypeResource
Idsnowflake.grant.grants_to

Fields

The following fields are returned by SELECT queries:

Properties of a grant that can be granted to a role or user.

NameDatatypeDescription
granted_by_namestringThe role that granted this privilege to this grantee (example: SUBADMIN)
grantee_namestringSpecific name of object being granted to (example: ACCOUNTADMIN)
securable_namestringName of specific object granted on (not name of privilege!)
created_onstring (date-time)
grant_optionbooleanCan grantee pass this privilege down?
granted_by_role_typestringType of role that granted this privilege to this grantee (example: ROLE)
grantee_typestringEntity type being granted to (example: ROLE)
privilegesarrayPrivilege type
securable_typestringType of object granted on (example: ACCOUNT)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_grants_toselectgranteeType, granteeName, endpointshowLimitList the roles and privileges granted to the specified grantee using the output of SHOW GRANTS TO

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
endpointstringOrganization and Account Name (default: orgid-acctid)
granteeNamestringString that specifies the name of the privilege grantee.
granteeTypestringString that specifies the type of resource that is the privilege grantee.
showLimitintegerQuery parameter to limit the maximum number of rows returned by a command.

SELECT examples

List the roles and privileges granted to the specified grantee using the output of SHOW GRANTS TO

SELECT
granted_by_name,
grantee_name,
securable_name,
created_on,
grant_option,
granted_by_role_type,
grantee_type,
privileges,
securable_type
FROM snowflake.grant.grants_to
WHERE granteeType = '{{ granteeType }}' -- required
AND granteeName = '{{ granteeName }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND showLimit = '{{ showLimit }}';