CREATE TAG
Introduced or updated: v1.2.863
Creates a new tag. Tags are tenant-level metadata objects that can be assigned to database objects for governance and classification.
See also: DROP TAG, SHOW TAGS, SET TAG / UNSET TAG
Syntax
CREATE TAG [ IF NOT EXISTS ] <tag_name>
[ ALLOWED_VALUES = ( '<value1>' [, '<value2>', ... ] ) ]
[ COMMENT = '<string>' ]
| Parameter | Description |
|---|---|
tag_name | Name of the tag to create. |
ALLOWED_VALUES | Optional list of permitted values. When set, only these values can be used in SET TAG. Duplicate values are removed automatically. |
COMMENT | Optional description for the tag. |
Examples
Create a tag with allowed values and a comment:
CREATE TAG env ALLOWED_VALUES = ('dev', 'staging', 'prod') COMMENT = 'Environment classification';
Create a tag that accepts any value:
CREATE TAG owner COMMENT = 'Data owner';
Create a tag with no restrictions:
CREATE TAG cost_center;
Verify tag definitions:
SELECT name, allowed_values, comment FROM system.tags ORDER BY name;
┌──────────────────────────────────────────────────────────────────────┐
│ name │ allowed_values │ comment │
├────────────────┼────────────────────────────┼────────────────────────┤
│ cost_center │ NULL │ │
│ env │ ['dev', 'staging', 'prod'] │ Environment classific… │
│ owner │ NULL │ Data owner │
└──────────────────────────────────────────────────────────────────────┘