ALTER DATABASE ROLE | Snowflake Documentation (original) (raw)

Modifies the properties for an existing database role.

Currently, the only supported operations are renaming a database role or adding/overwriting/removing a comment for a database role.

See also:

CREATE DATABASE ROLE , DROP DATABASE ROLE , SHOW DATABASE ROLES

Syntax

ALTER DATABASE ROLE [ IF EXISTS ] RENAME TO

ALTER DATABASE ROLE [ IF EXISTS ] SET COMMENT = ''

ALTER DATABASE ROLE [ IF EXISTS ] UNSET COMMENT

ALTER DATABASE ROLE [ IF EXISTS ] SET TAG = '' [ , = '' ... ]

ALTER DATABASE ROLE [ IF EXISTS ] UNSET TAG [ , ... ]

Parameters

_name_

Specifies the identifier (i.e. name) for the database role; must be unique in the database in which the role is created.

The identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (e.g. "My object"). Identifiers enclosed in double quotes are also case-sensitive.

If the identifier is not fully qualified in the form of _dbname_._databaserolename_, the command looks for the database role in the current database for the session.

RENAME TO _newname_

Specifies the new identifier for the database role; must be unique for your account.

For more details, see Identifier requirements.

Note that when specifying the fully-qualified name of the database role, you cannot specify a different database. The name of the database, _dbname_, must remain the same. Only the _databaserolename_ can change during a rename operation.

SET ...

Specifies the properties to set for the database role:

COMMENT = '_stringliteral_'

Adds a comment or overwrites an existing comment for the database role.

TAG _tagname_ = '_tagvalue_' [ , _tagname_ = '_tagvalue_' , ... ]

Specifies the tag name and the tag string value.

The tag value is always a string, and the maximum number of characters for the tag value is 256.

For information about specifying tags in a statement, see Tag quotas for objects and columns.

UNSET ...

Specifies the properties to unset for the database role, which resets them to the defaults.

Access control privileges

A role used to execute this operation must have the followingprivileges at a minimum:

Privilege Object Notes
OWNERSHIP Database role Only the database role owner (i.e. the database role with the OWNERSHIP privilege on the database role), or a higher role, can execute this command. The owner role does not inherit any permissions granted to the owned database role. To inherit permissions from a database role, that database role must be granted to another role, creating a parent-child relationship in a role hierarchy.
APPLY Tag Enables setting a tag on a database role.

Usage notes

Regarding metadata:

Attention

Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata fields in Snowflake.

Examples

Rename database role dr1 to dbr2 in database d1:

ALTER DATABASE ROLE d1.dr1 RENAME TO d1.dbr2;

Add a comment for database role d1.dbr2:

ALTER DATABASE ROLE d1.dbr2 SET COMMENT = 'New comment for database role';