Skip to main content

database_role_future_grants

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

Overview

Namedatabase_role_future_grants
TypeResource
Idsnowflake.roles.database_role_future_grants

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
containing_scopeobjectContaining scope of the grant
created_onstring (date-time)Date and time when the grant was created
grant_optionbooleanIf true, allows the recipient role to grant the privileges to other roles.
granted_bystringThe role that granted this privilege to this grantee
privilegesarrayList of privileges to be granted.
securableobjectSecurable of the grant
securable_typestringType of the securable to be granted.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectdatabase_name, name, endpointshowLimitList all future grants to the role
grantinsertdatabase_name, name, endpoint, securable_typeGrant future privileges to the role
revokeexecdatabase_name, name, endpoint, securable_typemodeRevoke future grants from the role

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
database_namestringIdentifier (i.e. name) for the database to which the resource belongs. You can use the /api/v2/databases GET request to get a list of available databases.
endpointstringOrganization and account identifier (orgname-accountname) (default: orgname-accountname)
namestringIdentifier (i.e. name) for the resource.
modestringParameter determines whether the revoke operation succeeds or fails for the privileges, based on the whether the privileges had been re-granted to another role. - restrict: If the privilege being revoked has been re-granted to another role, the REVOKE command fails. - cascade: If the privilege being revoked has been re-granted, the REVOKE command recursively revokes these dependent grants. If the same privilege on an object has been granted to the target role by a different grantor (parallel grant), that grant is not affected and the target role retains the privilege.
showLimitintegerParameter to limit the maximum number of rows returned by a command.

SELECT examples

List all future grants to the role

SELECT
containing_scope,
created_on,
grant_option,
granted_by,
privileges,
securable,
securable_type
FROM snowflake.roles.database_role_future_grants
WHERE database_name = '{{ database_name }}' -- required
AND name = '{{ name }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND showLimit = '{{ showLimit }}'
;

INSERT examples

Grant future privileges to the role

INSERT INTO snowflake.roles.database_role_future_grants (
securable,
containing_scope,
securable_type,
grant_option,
privileges,
database_name,
name,
endpoint
)
SELECT
'{{ securable }}',
'{{ containing_scope }}',
'{{ securable_type }}' /* required */,
{{ grant_option }},
'{{ privileges }}',
'{{ database_name }}',
'{{ name }}',
'{{ endpoint }}'
RETURNING
status
;

Lifecycle Methods

Revoke future grants from the role

EXEC snowflake.roles.database_role_future_grants.revoke
@database_name='{{ database_name }}' --required,
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required,
@mode='{{ mode }}'
@@json=
'{
"securable": "{{ securable }}",
"containing_scope": "{{ containing_scope }}",
"securable_type": "{{ securable_type }}",
"grant_option": {{ grant_option }},
"privileges": "{{ privileges }}"
}'
;