Categories:

User & Security DDL

ALTER TAG

Modifies the properties for an existing tag, including renaming the tag.

Any changes made to the tag go into effect when the next SQL query that uses the tag runs.

See also:

Specifying Tag Values , TAGS View , CREATE TAG , DROP TAG , SHOW TAGS

Syntax

ALTER TAG [ IF EXISTS ] <name> RENAME TO <new_name>

ALTER TAG [ IF EXISTS ] <name> { ADD | DROP } ALLOWED_VALUES '<val_1>' [ , '<val_2>' , [ ... ] ]

ALTER TAG <name> UNSET ALLOWED_VALUES

ALTER TAG [ IF EXISTS ] <name> SET COMMENT = '<string_literal>'

ALTER TAG [ IF EXISTS ] <name> UNSET COMMENT

Parameters

name

Identifier for the tag. Assign the tag string value on an object using either a CREATE <object> statement or an ALTER <object> statement.

The identifier value 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.

For more details, see Identifier Requirements

RENAME TO new_name

Specifies the new identifier for the tag; must be unique for your schema. The new identifier cannot be used if the identifier is already in place for a different tag.

For more details, see Identifier Requirements.

ALLOWED_VALUES 'val_1' [ , 'val_2' , [ ... ] ]

Specifies a comma-separated list of the possible string values that can be assigned to the tag when the tag is set on an object using the corresponding CREATE <object> or ALTER <object> command.

The maximum number of tag values in this list is 50.

Default: NULL (all string values are allowed, including an empty string value (i.e. ' ')).

COMMENT = 'string_literal'

Specifies a comment for the tag.

Default: No value

UNSET

Specifies one (or more) properties and/or parameters to unset for the tag, which resets them to the defaults:

  • COMMENT

  • ALLOWED_VALUES

Access Control Requirements

A role used to execute this SQL command must have the following privileges at a minimum:

Privilege

Object

Notes

OWNERSHIP

Tag

OWNERSHIP is a special privilege on an object that is automatically granted to the role that created the object, but can also be transferred using the GRANT OWNERSHIP command to a different role by the owning role (or any role with the MANAGE GRANTS privilege).

Note that operating on any object in a schema also requires the USAGE privilege on the parent database and schema.

For instructions on creating a custom role with a specified set of privileges, see Creating Custom Roles.

For general information about roles and privilege grants for performing SQL actions on securable objects, see Access Control in Snowflake.

For additional details on tag DDL and privileges, see Managing Tags.

Usage Notes

  • For more information on tag DDL authorization, see required privileges.

  • 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 the cost_center tag to cost_center_na, where na specifies North America.

alter tag cost_center rename to cost_center_na;
Back to top