📌 What is Tagging in Snowflake?
Tagging lets you attach key-value metadata to Snowflake objects—like tables, views, columns, warehouses, databases, and more. This supports data governance, cost tracking, and compliance.
✅ Common Use Cases
- Cost Allocation: Tag compute/storage for billing or chargeback.
- Data Classification: Mark columns as sensitive (PII, PCI, etc).
- Compliance & Governance: Flag regulated data for audits.
- Operational Organization: Group objects (e.g., by environment or owner).
🎯 Why Tagging is Important
- Data Governance: Tags let you trace and report sensitive data.
- Cost Control: Assign tags (like
cost_center) to track spend by department. - Better Organization: Instantly filter or locate objects by tag (e.g.,
environment = production). - Simplified Auditing: Use tags in
ACCOUNT_USAGEviews for compliance reporting.
⚙️ How to Use Tagging in Snowflake
1️⃣ Create a Tag
CREATE TAG business_unit COMMENT = 'Identifies business unit ownership/cost center';
2️⃣ Assign Tag to Multiple Objects (Tables, Warehouse, Database)
-- Assign to database
ALTER DATABASE sales_db SET TAG business_unit = 'Retail';
-- Assign to warehouse
ALTER WAREHOUSE wh_retail SET TAG business_unit = 'Retail';
-- Assign to tables
ALTER TABLE sales_db.public.order_header SET TAG business_unit = 'Retail';
ALTER TABLE sales_db.public.order_detail SET TAG business_unit = 'Retail';
3️⃣ View Tag Assignments
You can identify where a tag is applied across your account:
-- List all objects with the 'business_unit' tag
SELECT OBJECT_TYPE, OBJECT_NAME, TAG_NAME, TAG_VALUE
FROM SNOWFLAKE.ACCOUNT_USAGE.TAG_REFERENCES
WHERE TAG_NAME = 'BUSINESS_UNIT' AND TAG_VALUE = 'Retail'
ORDER BY OBJECT_TYPE, OBJECT_NAME;
Sample Output:
| OBJECT_TYPE | OBJECT_NAME | TAG_NAME | TAG_VALUE |
|---|---|---|---|
| DATABASE | SALES_DB | BUSINESS_UNIT | Retail |
| WAREHOUSE | WH_RETAIL | BUSINESS_UNIT | Retail |
| TABLE | SALES_DB.PUBLIC.ORDER_HEADER | BUSINESS_UNIT | Retail |
| TABLE | SALES_DB.PUBLIC.ORDER_DETAIL | BUSINESS_UNIT | Retail |
4️⃣ Remove Tag from an Object
ALTER TABLE sales_db.public.order_header UNSET TAG business_unit;
📂 Objects You Can Tag
| Object Type | Can Tag? |
|---|---|
| Tables | ✅ |
| Views (Secure & Standard) | ✅ |
| Schemas | ✅ |
| Databases | ✅ |
| Columns | ✅ |
| Warehouses | ✅ |
| Tasks | ✅ |
| Streams, Shares, Pipes, Procs | ✅ |
🔑 Roles and Privileges
| Role/Privilege | Purpose |
|---|---|
ACCOUNTADMIN | Full control over tag management |
SECURITYADMIN | Can create tags and assign to objects |
USAGE + APPLY on tag | Required for assigning tags |
| Custom Roles | Fine-grained access for tagging |
⚠️ Limitations
- Tag names must be unique per schema/database.
- Only one value per tag per object.
- Tags do not inherit automatically to child objects.
- Tag values are plain strings, not structured.
✅ System-Defined vs User-Defined Tags
System-Defined Tags (from Data Classification)
Snowflake automatically assigns tags when you run data classification via SYSTEM$CLASSIFY.
Examples:
SEMANTIC_CATEGORY→ values likeEMAIL,PHONE_NUMBER,NAMEPRIVACY_CATEGORY→ values likePII,SENSITIVE,NONE
❗ You cannot create custom values for these tags; they are managed by Snowflake.
User-Defined Tags
You create these for business needs:
environment→dev/test/prodcost_center→finance/marketingdata_owner→john.doe
Example:
CREATE TAG cost_center COMMENT='Tracks cost by department';
ALTER WAREHOUSE wh_x SET TAG cost_center = 'Finance';
💡 Best Practices
- Standardize tag keys and values for consistency.
- Apply tags during object creation, not later.
- Follow clear naming conventions.
- Regularly audit tag usage with
ACCOUNT_USAGE.TAG_REFERENCES. - Tie masking policies to tags for automated protection.
⚡ Key Takeaways
- Tags = metadata for governance, cost, and organization.
- System tags come from Snowflake classification (e.g.,
SEMANTIC_CATEGORY). - User tags are for business (cost, team, environment).
- Masking policies and audits use tags.
- Tag all critical objects to improve compliance and discoverability.
🚀 Example: Why Tag and How to Identify Its Use
If you create a tag and apply it to tables, a warehouse, and a database (as above), you can:
- Group Objects: Instantly locate all resources (tables, warehouses, databases) for a business function.
- Manage Costs: Track warehouse/database/table usage billed to the “Retail” group.
- Govern Access: Filter for sensitive objects during audit or compliance review.
- Operational Efficiency: Selectively migrate, update, or report on all objects tagged “Retail”.
How to find all tagged objects:
Query ACCOUNT_USAGE.TAG_REFERENCES or use the Snowsight UI for graphical tag exploration.
In summary:
Tagging is the backbone of Snowflake’s governance and organization toolkit. It lets business and technical teams classify, group, and track every object—making your data estate transparent, auditable, and easier to manage.