Skip to main content

grants

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

Overview

Namegrants
TypeResource
Idsnowflake.user.grants

Fields

NameDatatypeDescription
containing_scopeobject
created_onstringDate 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

NameAccessible byRequired ParamsDescription
list_grantsSELECTname, endpointList all grants to the user
grantINSERTname, data__securable_type, endpointGrant a role to the user
revoke_grantsDELETEname, data__securable_type, endpointRevoke grants from the user

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 }}'
AND endpoint = '{{ endpoint }}';

INSERT example

Use the following StackQL query and manifest file to create a new grants resource.

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

DELETE example

Deletes the specified grants resource.

/*+ delete */
DELETE FROM snowflake.user.grants
WHERE name = '{{ name }}'
AND data__securable_type = '{{ data__securable_type }}'
AND endpoint = '{{ endpoint }}';