Skip to main content

grants

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

Overview

Namegrants
TypeResource
Idsnowflake.user.grants

Fields

The following fields are returned by SELECT queries:

successful

NameDatatypeDescription
containing_scopeobject
created_onstring (date-time)Date and time when the grant was created
granted_bystringThe role that granted this privilege to this grantee
privilegesarrayList of privileges to be granted.
securableobject
securable_typestringType of the securable to be granted. Only ROLE is supported

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_grantsselectname, endpointshowLimitList all grants to the user
grantinsertname, endpointGrant a role to the user
revoke_grantsdeletename, endpointRevoke grants from the user

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)
namestringIdentifier (i.e. name) for the resource.
showLimitintegerQuery parameter to limit the maximum number of rows returned by a command.

SELECT examples

List all grants to the user

SELECT
containing_scope,
created_on,
granted_by,
privileges,
securable,
securable_type
FROM snowflake.user.grants
WHERE name = '{{ name }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND showLimit = '{{ showLimit }}';

INSERT examples

Grant a role to the user

INSERT INTO snowflake.user.grants (
data__securable,
data__containing_scope,
data__securable_type,
data__privileges,
name,
endpoint
)
SELECT
'{{ securable }}',
'{{ containing_scope }}',
'{{ securable_type }}' --required,
'{{ privileges }}',
'{{ name }}',
'{{ endpoint }}'
;

DELETE examples

Revoke grants from the user

DELETE FROM snowflake.user.grants
WHERE name = '{{ name }}' --required
AND endpoint = '{{ endpoint }}' --required;