Data Governance · Topic 1 of 7

Object Tagging and Data Classification

Monitor data in Snowflake with object tags, tag inheritance and propagation, system classification tags, classification profiles and tag based masking.

  • 5 min
In a nutshell
  • Tags are string key and value pairs, inherited down the object hierarchy, up to 50 per object.
  • ACCOUNT_USAGE.TAG_REFERENCES for account wide, INFORMATION_SCHEMA.TAG_REFERENCES for one object.
  • Classification uses SNOWFLAKE.CORE.SEMANTIC_CATEGORY and PRIVACY_CATEGORY; categories IDENTIFIER, QUASI_IDENTIFIER, SENSITIVE.

What it is

Monitoring data in Snowflake starts with knowing what you have and how sensitive it is. Object tags are labels you attach to objects, such as pii = 'email', so that you can find, report on and protect them. Data classification looks at column names and contents and applies system tags for you.

Together they answer the governance questions "where is sensitive data" and "who can see it".

Columnsnames and valuesclassifySystem tagsSEMANTIC and PRIVACY categorylinked toMasking policytag basedprotectsSensitive columns

How it works

Object tagging

A tag is a schema level object with a name and a string value.

CREATE TAG governance.tags.cost_center ALLOWED_VALUES 'sales', 'finance', 'it';
ALTER TABLE orders SET TAG governance.tags.cost_center = 'sales';
ALTER TABLE customers MODIFY COLUMN email SET TAG governance.tags.pii = 'email';
SELECT SYSTEM$GET_TAG('governance.tags.pii', 'customers.email', 'COLUMN');
  • Tag values are always strings.
  • ALLOWED_VALUES restricts a tag to a list, which keeps tagging consistent.
  • You can tag many object types, including tables, views, columns, schemas, databases, warehouses and users, up to 50 tags on one object.
  • Creating and setting tags is available in all editions, while tag propagation and tag based masking need Enterprise or higher.
  • The global APPLY TAG privilege lets a role tag any object. Future grants on tags are not supported, so give APPLY TAG to a custom tagging role.

Inheritance and propagation

BehaviorMeaning
InheritanceA tag set on a container applies to the objects below it. A tag on a table applies to all its columns, and a tag on a schema applies to its tables
PropagationWhen the tag is configured to propagate, it follows data automatically, for example from a table to a view built on it, or to a new table created with CTAS

Inheritance goes down the hierarchy. You can override it by setting a different value on a lower object.

Databasetag set hereinherited bySchemainherited byTableinherited byColumnsame tag value

Finding tags

SourceUse
SNOWFLAKE.ACCOUNT_USAGE.TAG_REFERENCES viewAccount wide list of what is tagged, with the apply_method column showing how a tag got there
INFORMATION_SCHEMA.TAG_REFERENCES functionTags on one object, including inherited ones
INFORMATION_SCHEMA.TAG_REFERENCES_ALL_COLUMNS functionTags on every column of a table
SYSTEM$GET_TAGValue of one tag on one object
Exam tip

ACCOUNT_USAGE views lag behind real time. For an immediate check on one object, use the INFORMATION_SCHEMA function.

Tag based masking

You can assign a masking policy to a tag. Every column that carries the tag, directly or by inheritance, and has a matching data type is then masked automatically.

ALTER TAG governance.tags.pii SET MASKING POLICY mask_string;

This scales protection. You tag a column once, and the policy follows.

Data classification

Classification analyzes a column's name and sample values and assigns two system tags in the SNOWFLAKE.CORE schema.

System tagMeaningExample values
SEMANTIC_CATEGORYWhat the data isNAME, EMAIL, national identifier, custom categories
PRIVACY_CATEGORYHow sensitive it isIDENTIFIER, QUASI_IDENTIFIER, SENSITIVE
  • An identifier points directly at a person, such as a name or national ID.
  • A quasi identifier identifies someone only in combination with other columns, such as postal code or birth date.
  • SENSITIVE covers data such as salary or diagnosis.

Classification can run in three ways.

  • On demand, with SYSTEM$CLASSIFY, optionally applying the tags itself.
  • Automatically, with a classification profile attached to a database or schema. Snowflake then classifies new objects shortly after creation and reclassifies them periodically.
  • From Snowsight, through the Trust Center classification pages.
SELECT SYSTEM$CLASSIFY('sales.public.customers', {'auto_tag': true});

A profile can also contain custom classifiers and custom categories, so a company can find its own formats, such as an internal employee ID. Classification needs Enterprise edition or higher.

Results are used to monitor: you query the tags to list all columns with a privacy category, you review the sensitive data monitoring in Snowsight, and you link tags to masking policies. Classification itself is serverless and shows up as credits in the metering views.

New tablecreated in databaseprofile runsClassificationserverlessappliesTags on columnsSEMANTIC and PRIVACYqueried byGovernance reportsand tag based masking
Watch out

Classification tags describe what Snowflake found. They do not protect anything by themselves. You still need a masking policy, directly or through a tag, to hide the values.

Common mistakes

Believing tags protect data. A tag is only a label until a policy uses it.

Expecting tag changes to appear instantly in ACCOUNT_USAGE. Those views have latency.

Confusing identifier types. A quasi identifier needs other columns to identify someone.

Assuming Standard edition has tag based masking. It requires Enterprise or higher.

What to remember for the exam

  • Tags are string key and value pairs, inherited down the object hierarchy, up to 50 per object.
  • ACCOUNT_USAGE.TAG_REFERENCES for account wide, INFORMATION_SCHEMA.TAG_REFERENCES for one object.
  • Classification uses SNOWFLAKE.CORE.SEMANTIC_CATEGORY and PRIVACY_CATEGORY; categories IDENTIFIER, QUASI_IDENTIFIER, SENSITIVE.
  • SYSTEM$CLASSIFY for on demand work, classification profiles for automatic work; tag based masking links a policy to a tag.

Check yourself

  • A tag is set on a schema. What do tables in that schema see?

    They inherit the tag, and so do their columns, unless a lower level overrides it.

  • Which classification system tag shows IDENTIFIER, QUASI_IDENTIFIER or SENSITIVE?

    SNOWFLAKE.CORE.PRIVACY_CATEGORY.

  • How can you protect every column labeled with a PII tag without touching each column?

    Attach a masking policy to the tag, so all columns with that tag and a matching type are masked.

Topic 1 of 7 in Data Governance

Test yourself on Data Governance

The full Snowflake DEA-C02 question bank has 709 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Snowflake. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.