Back to changelog
New
3 minute read

Snowflake: Tag Support

Atlas now supports Snowflake tags as first-class resources. Define a tag once in HCL, assign it to schemas, tables, columns, views, and other Snowflake objects, and Atlas plans the CREATE TAG and tag-assignment statements for you.

A tag is a schema-level object that you assign to other Snowflake objects together with a string value, forming a key/value label used to organize and classify them. You can now define tags in HCL and assign them to a broad set of objects, which Atlas then inspects, diffs, and migrates declaratively.

Enabling the Feature

Tag management with Atlas is opt-in. To enable it, set tags = true inside the mode "snowflake" block of your env:

env "prod" {
url = "snowflake://user:pass@account_identifier/database"
dev = "snowflake://user:pass@dev_account_identifier/database"
schema {
src = "file://schema.hcl"
mode "snowflake" {
tags = true
}
}
}

Defining a Tag

The tag block declares a tag in a given schema, with an optional list of allowed_values that constrain what can be assigned, and a comment:

tag "USER_DOMAIN" {
schema = schema.SALES
allowed_values = ["customer", "employee"]
comment = "data domain tag"
}
Note: Enterprise-only behaviors such as PROPAGATE and ON_CONFLICT, along with preview features, are not yet supported.

Atlas generates the matching statement:

-- Create tag "USER_DOMAIN"
CREATE TAG "SALES"."USER_DOMAIN" ALLOWED_VALUES 'customer', 'employee' COMMENT = 'data domain tag';

Assigning a Tag

To assign a tag to an object, add a nested tag block that references the tag with ref and supplies a value. Atlas plans the appropriate assignment statement for each object type:

table "USERS" {
schema = schema.SALES
column "CUSTOMER_ID" {
type = NUMBER(38)
}
column "NAME" {
type = VARCHAR(16777216)
}
tag {
ref = tag.USER_DOMAIN
value = "customer"
}
}

And Atlas generates the matching statement with the tag assignment included:

-- Create "USERS" table
CREATE TABLE "SALES"."USERS" (
"CUSTOMER_ID" NUMBER NOT NULL,
"NAME" VARCHAR NOT NULL
) WITH TAG (SALES.USER_DOMAIN = 'customer');

Tags and their assignments are supported across a broad set of objects: schemas, warehouses, tables (including standard, dynamic, external, Iceberg, and hybrid tables), table columns, views and view columns, functions, procedures, tasks, stages, and pipes.

featuresnowflaketagmetadatagovernance