Skip to main content

roles

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

Overview

Nameroles
TypeResource
Idsnowflake.role.roles

Fields

NameDatatypeDescription
namestringName of the role.
assigned_to_usersintegerThe number of users to whom this role has been assigned.
commentstringComment of the role.
created_onstringDate and time when the role was created.
granted_rolesintegerThe number of roles that have been granted to this role.
granted_to_rolesintegerThe number of roles to which this role has been granted.
is_currentbooleanSpecifies whether the role being fetched is the user's current role.
is_defaultbooleanSpecifies whether the role being fetched is the user's default role.
is_inheritedbooleanSpecifies whether the role used to run the command inherits the specified role.
ownerstringSpecifies the role that owns this role.

Methods

NameAccessible byRequired ParamsDescription
list_rolesSELECTendpointList roles
create_roleINSERTdata__name, endpointCreate a role
delete_roleDELETEname, endpointDelete a role

SELECT examples

List roles

SELECT
name,
assigned_to_users,
comment,
created_on,
granted_roles,
granted_to_roles,
is_current,
is_default,
is_inherited,
owner
FROM snowflake.role.roles
WHERE endpoint = '{{ endpoint }}';

INSERT example

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

/*+ create */
INSERT INTO snowflake.role.roles (
data__name,
data__comment,
endpoint
)
SELECT
'{{ name }}',
'{{ comment }}',
'{{ endpoint }}'
;

DELETE example

Deletes the specified roles resource.

/*+ delete */
DELETE FROM snowflake.role.roles
WHERE name = '{{ name }}'
AND endpoint = '{{ endpoint }}';