Skip to content

RoleGrant

Snowflake Documentation | Snowcap CLI label: role_grant

Represents a grant of a role to another role or user in Snowflake.

Examples

YAML

role_grants:
  # Grant multiple roles to a role
  - to_role: analyst
    roles:
      - z_db__raw
      - z_db__analytics
      - z_wh__transforming

  # Grant multiple roles to a user
  - to_user: jane_doe
    roles:
      - analyst
      - developer

Python

# Grant to Role:
role_grant = RoleGrant(role="somerole", to_role="someotherrole")

# Grant to User:
role_grant = RoleGrant(role="somerole", to_user="someuser")

Fields

  • role (string or Role, required) - The role to be granted.
  • to_role (string or Role) - The role to receive the grant.
  • to_user (string or User) - The user to receive the grant.

Note: You must specify either to_role or to_user, but not both.

In YAML, you can also use the shorthand syntax with roles (list) to grant multiple roles at once.