Categories:

User & Security DDL

CREATE TAG

Creates a new tag or replaces an existing tag in the system.

See also:

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

Syntax

CREATE [ OR REPLACE ] TAG [ IF NOT EXISTS ] <name> [ COMMENT = '<string_literal>' ]

CREATE [ OR REPLACE ] TAG [ IF NOT EXISTS ] <name>
    [ ALLOWED_VALUES '<val_1>' [ , '<val_2>' , [ ... ] ] ]

Required 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.

Optional Parameters

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

Access Control Requirements

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

Privilege

Object

Notes

CREATE TAG

Schema

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

  • Snowflake limits the number of tags in an account to 10,000.

  • For more information on how tags can be associated to Snowflake objects, see Object Tagging.

  • 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

Create a tag with the key cost_center.

create tag cost_center comment = 'cost_center tag';
Back to top