What you will be able to do
- Explain the semantic and privacy category system tags that classification assigns
- Build a classification profile with category filters and a tag map, and attach it to a database or schema
- Define custom classifiers and predict which category the scoring rule recommends
- Run on-demand classification with SYSTEM$CLASSIFY and connect its results to tag-based masking
1.Semantic and privacy categories as system tags
Sensitive data classification finds personal and regulated data so you don't have to locate it by hand. Snowflake samples columns and labels the ones that hold sensitive data. Those labels become tags that governance controls can act on. Each sensitive column gets two labels. The semantic category says what kind of attribute the column holds, such as NAME, EMAIL or NATIONAL_IDENTIFIER, or a custom category you define. The privacy category says how sensitive it is: IDENTIFIER, QUASI_IDENTIFIER or SENSITIVE. SENSITIVE covers non-identifying data such as health data or salary.
Both labels are stored as system-defined tags. SNOWFLAKE.CORE.SEMANTIC_CATEGORY holds the native or custom category, and SNOWFLAKE.CORE.PRIVACY_CATEGORY holds the privacy category. Your own policies usually key on your own tags, so you can map user-defined tags to these system tags. For example, whenever SEMANTIC_CATEGORY = 'NAME' is applied, tag_db.sch.pii = 'Highly confidential' is applied too. The tags classification writes take priority over inherited values. A column that inherited a tag from its schema gets the classification value instead.
Checkpoint 1 of 4· Check yourself
Schema SALES carries the user-defined tag tag_db.sch.pii = 'Public', so every column in it inherits that value. A classification profile maps SNOWFLAKE.CORE.SEMANTIC_CATEGORY = 'NAME' to tag_db.sch.pii = 'Highly confidential'. Classification then labels SALES.CUSTOMERS.FULL_NAME as NAME. What value of tag_db.sch.pii does FULL_NAME end up with?
An inherited value is only a default. Sensitive data classification overwrites it, so the mapped value from the tag map is applied to the column. CONFLICT and merged values apply only when propagation conflicts are resolved through ON_CONFLICT, not here.
“The value of an inherited tag is overwritten by sensitive data classification.”Source: docs.snowflake.com
Sources1
2.Classification profiles for automatic classification
A classification profile holds the settings for automatic classification. If you configure classification in the Trust Center, your settings are saved as a profile. In SQL you create it as an instance of SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILE. A profile controls the following:
- how old a table must be before it is classified (
minimum_object_age_for_classification_days) and how long until it is classified again - whether system and mapped tags are applied automatically (
auto_tag) or only proposed for you to review and apply - a tag map from semantic categories to user-defined tags
- whether custom classifiers are used
- whether views are classified (
classify_views); views are left out unless it is true - which native semantic categories to classify (
snowflake_semantic_categories), optionally narrowed bycountry_codes - whether AI mode is on (
ai_mode), which uses an LLM (currently only OpenAI GPT-5 Mini) to find more semantic categories
CREATE OR REPLACE SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILE
my_classification_profile(
{
'minimum_object_age_for_classification_days': 0,
'snowflake_semantic_categories':
[
{
'category': 'NAME'
},
{
'category': 'PASSPORT',
'country_codes': ['US']
}
]
});You can add the tag map when you create the profile, or later with the SET_TAG_MAP method. When several entries could match one column, the first entry in column_tag_map wins, so put the most specific mappings first. tag_name is the only required key. If you leave out tag_value and semantic_categories, the user-defined tag goes on every classified column and copies its SEMANTIC_CATEGORY value. With the map below, a column of email addresses gets tag_db.sch.pii = 'Confidential'.
'tag_map': {
'column_tag_map': [
{
'tag_name':'tag_db.sch.pii',
'tag_value':'Highly Confidential',
'semantic_categories':[
'NAME',
'NATIONAL_IDENTIFIER'
]
},
{
'tag_name': 'tag_db.sch.pii',
'tag_value':'Confidential',
'semantic_categories': [
'EMAIL'
]
}
]
}Creating a profile does not classify anything. Classification starts when you set the profile on a database or a schema with the CLASSIFICATION_PROFILE parameter. auto_tag and the tag map are settings inside the profile and do nothing until it is attached. From then on, the tables inside are classified on the profile's schedule, and views only if the profile sets classify_views to true. If a schema's database also has a profile, the schema's profile takes precedence. A database where only some schemas have a profile appears as partially monitored in the Trust Center. To list monitored databases in SQL, call SYSTEM$SHOW_SENSITIVE_DATA_MONITORED_ENTITIES('DATABASE').
ALTER DATABASE my_db
SET CLASSIFICATION_PROFILE = 'governance_db.classify_sch.my_profile';Classification does not begin the moment the parameter is set: there is a one-hour delay before Snowflake starts classifying. Setting up automatic classification also takes several grants to the engineer's role:
- USAGE and EXECUTE AUTO CLASSIFICATION on the database
- the
SNOWFLAKE.CLASSIFICATION_ADMINdatabase role - CREATE
SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILEon the schema that will hold the profile - APPLY TAG on the account
Classification runs on serverless compute and consumes credits. AI mode adds LLM token charges. Views can cost more to classify than tables, depending on how complex the query behind them is, and they are excluded by default. Materialized views don't carry that extra cost.
Checkpoint 2 of 4· Fill the gap
A data engineer created a classification profile a week ago, but no tables in my_db have been classified yet. Which parameter completes the statement that starts automatic classification of the database?
ALTER DATABASE my_db
SET ? = 'governance_db.classify_sch.my_profile';Creating a profile does not classify anything. Classification starts only when you set the CLASSIFICATION_PROFILE parameter on a database or schema. auto_tag and the tag map are settings inside the profile, and PROPAGATE is a property of a tag, not of a database.
Source: docs.snowflake.com3.Custom classifiers for domain-specific data
Native categories don't cover identifiers specific to your organisation, such as employee IDs or internal medical codes. For those you define a custom classifier, an instance of the CUSTOM_CLASSIFIER class in SNOWFLAKE.DATA_PRIVACY. Each one pairs a custom semantic category with regular expressions that match column values, and optionally the column name, plus one of the predefined privacy categories. You add the regular expressions with the instance's ADD_REGEX method, which also lets you set the scoring threshold.
A profile stores a copy of the classifier's definition, not a link to it. If you edit a classifier, profiles that use it keep running the old version until you call SET_CUSTOM_CLASSIFIERS on each one. A regex fix that never reaches the profile is a common reason a custom category stops matching.
The custom category is recommended only when the sample clears a threshold, which defaults to 0.8. That means 80 percent of the sampled values must match your regular expressions. If you also supplied a name matcher, the column name must match as well. In every other case, the Snowflake category is recommended instead.
| Name matcher provided | Values match at or above threshold | Column name matches | Recommendation |
|---|---|---|---|
| Yes | Yes | Yes | Custom category |
| Yes | Yes | No | Snowflake category |
| Yes | No | Yes | Snowflake category |
| Yes | No | No | Snowflake category |
| No | Yes | Not applicable | Custom category |
| No | No | Not applicable | Snowflake category |
Two custom classifiers can end up with the same score for a column. The tie is broken first by the match percentage between the respective custom categories, and if that is also tied, by the category name that comes first alphabetically. The winner is the recommended category and the rest are returned as alternates.
Checkpoint 3 of 4· Check yourself
Two weeks ago a governance team fixed the regular expression in their EMPLOYEE_ID custom classifier. The two classification profiles that use it are still set on their databases, but new employee ID columns still aren't getting the custom category. What do they need to do?
A profile stores a copy of the custom classifier's definition, not a link to it. Profiles keep running the old regex until SET_CUSTOM_CLASSIFIERS is called on each one. Setting the profile on the database again or lowering the threshold doesn't change the outdated copy the profile holds.
“If you change the custom classifier, you must use the SET_CUSTOM_CLASSIFIERS method to update the classification profile with the new definition.”Source: docs.snowflake.com
Sources4
4.On-demand classification with SYSTEM$CLASSIFY, feeding masking
Profiles classify on a schedule. SYSTEM$CLASSIFY classifies one object right away, which suits a table you just loaded or a single object you want to check. The object can be a table, an external table, a view or a materialized view. The second argument is either a classification profile, so the call uses that profile's criteria and AI mode if it is on, or a JSON options object.
SYSTEM$CLASSIFY( '<object_name>' ,
{ '<classification_profile>' | <options> } )Unless you ask for tags, an on-demand run only gives recommendations. Passing NULL or {} uses the default configuration, which sizes the sample from the row count, and sets no system tags. {'sample_count': n} sets the sample size, from 1 to 10000 rows. {'auto_tag': true} writes the recommended system tags to the columns once classification finishes. Call it with a role that has the OWNERSHIP privilege on the schema.
Custom classifiers join an on-demand run through two options. {'use_all_custom_classifiers': true} evaluates every custom classifier the calling role can access, because the procedure runs with caller's rights. {'custom_classifiers': ['instance_name1', 'instance_name2']} evaluates only the instances you list.
Manual classification is the same run without auto_tag. The call returns, for each column, a recommendation (semantic category, privacy category, confidence) and any alternates, and no tag is written. You review that output and apply the tags you accept yourself. To set a different system tag value, use ALTER TABLE ... MODIFY COLUMN ... SET TAG, and to remove a classification tag use UNSET TAG. A profile with auto_tag off works the same way: it proposes tag assignments for you to review rather than applying them. Hand-set tags are protected, since automatic classification raises an error when it clashes with one.
The tags are what make classification enforceable. Tag-based masking policies bind a masking policy to a user-defined tag. If a profile's tag map applies that tag to a newly classified column, the column is masked as soon as the tag lands. As new data arrives and gets classified, its sensitive columns are masked without a separate step. If the tag also propagates, the views and CTAS copies built from those columns are masked too.
Checkpoint 4 of 4· Check yourself
Masking policy pii_mask is attached to the user-defined tag tag_db.sch.pii. A classification profile with auto_tag on maps SEMANTIC_CATEGORY = 'EMAIL' to that tag and is set on the landing database. A new table with a column of email addresses lands there and gets classified. What else must happen before analysts querying that column see masked values?
In tag-based masking, the policy is bound to the tag. When classification writes the mapped tag onto a column, that column is masked straight away. Propagation only matters for objects built from the column, such as views and CTAS copies, not for the classified column itself.
“the data will be automatically masked when Snowflake applies the tag as part of the classification process.”Source: docs.snowflake.com
Practise it for real
Set up automatic classification of a database that classifies only names and US passports, then confirm the database is monitored.
1.As ACCOUNTADMIN, grant the data engineer role USAGE and EXECUTE AUTO CLASSIFICATION on my_db, the SNOWFLAKE.CLASSIFICATION_ADMIN database role, CREATE SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILE on the schema that will hold the profile, and APPLY TAG on the account. Then switch to that role.
Why: Creating a profile and setting it on a database both need these privileges.
You should see: The data engineer role can create a profile and set it on my_db.
2.Create the profile with CREATE OR REPLACE SNOWFLAKE.DATA_PRIVACY.CLASSIFICATION_PROFILE my_classification_profile, using the NAME and PASSPORT/US categories from the example.
Why: The profile holds the criteria: minimum table age and the semantic categories to classify.
You should see: The profile object is created. No tables are classified yet.
3.Run ALTER DATABASE my_db SET CLASSIFICATION_PROFILE = 'governance_db.classify_sch.my_classification_profile', replacing the quoted value with the fully qualified name of the profile you created.
Why: Classification only starts once a profile is set on a database or schema.
You should see: The tables in my_db are classified on the profile's schedule, beginning after a one-hour delay.
4.Run SELECT SYSTEM$SHOW_SENSITIVE_DATA_MONITORED_ENTITIES('DATABASE');
Why: Shows which databases have a profile attached.
You should see: my_db appears in the result.
Stuck? Get a nudge
If my_db shows as partially monitored in the Trust Center, someone set a profile on one of its schemas rather than on the database.
Sources
(7)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“every column that is identified as containing sensitive data is assigned two categories: a semantic category and a privacy category.”
↩︎ Semantic and privacy categories as system tags“It can be IDENTIFIER, QUASI_IDENTIFIER, or SENSITIVE”
↩︎ Semantic and privacy categories as system tags“You can map user-defined tags to system-defined classification tags.”
↩︎ Semantic and privacy categories as system tags“Sensitive data classification consumes credits as it uses serverless compute resources to classify tables in the database.”
↩︎ Classification profiles for automatic classification“the data will be automatically masked when Snowflake applies the tag as part of the classification process.”
↩︎ On-demand classification with SYSTEM$CLASSIFY, feeding masking“By default, views are excluded from classification.”
↩︎ Exam trap 2 - 2.
“How long a table should exist before automatically classifying it.”
↩︎ Classification profiles for automatic classification“the order of the JSON objects determines which tag and value to set on the column if there is a conflict”
↩︎ Classification profiles for automatic classification“the profile set on the schema overrides the profile set on the database.”
↩︎ Classification profiles for automatic classification“There is a one-hour delay between setting the classification profile on the schema and Snowflake beginning to classify the schema.”
↩︎ Classification profiles for automatic classification“GRANT EXECUTE AUTO CLASSIFICATION ON DATABASE mydb TO ROLE data_engineer;”
↩︎ Classification profiles for automatic classification“You can decide whether you want Snowflake to automatically apply suggested tags or prefer to review proposed tag assignments, then apply them yourself.”
↩︎ On-demand classification with SYSTEM$CLASSIFY, feeding masking“If there is a conflict with a manually assigned tag and a tag applied by automatic classification, an error occurs.”
↩︎ Prediction - 3.
“Snowflake classifies data in tables and views ('classify_views': true).”
↩︎ Classification profiles for automatic classification - 4.
“One of the pre-defined privacy categories.”
↩︎ Custom classifiers for domain-specific data“Eighty percent of the data in the sample must match the regular expressions that you add to the instance.”
↩︎ Custom classifiers for domain-specific data“Alphabetical order between the names of the custom categories.”
↩︎ Custom classifiers for domain-specific data“Sensitive data classification stores the definition of a custom classifier, not a reference.”
↩︎ Exam trap 1“If you change the custom classifier, you must use the SET_CUSTOM_CLASSIFIERS method to update the classification profile with the new definition.”
↩︎ Checkpoint - 5.
“The name of the table, external table, view, or materialized view containing the columns to be classified.”
↩︎ On-demand classification with SYSTEM$CLASSIFY, feeding masking“Any number from 1 to 10000, inclusive.”
↩︎ On-demand classification with SYSTEM$CLASSIFY, feeding masking“call the stored procedure with the role that has the OWNERSHIP privilege on the schema”
↩︎ On-demand classification with SYSTEM$CLASSIFY, feeding masking“Snowflake evaluates all custom classification instances and recommends the tag associated with a custom classification instance based on the classification result.”
↩︎ On-demand classification with SYSTEM$CLASSIFY, feeding masking“System tags are not set on any columns in the specified object.”
↩︎ Exam trap 3 - 6.
“use an ALTER TABLE … MODIFY COLUMN … SET TAG statement to update the tag value.”
↩︎ On-demand classification with SYSTEM$CLASSIFY, feeding masking
Also cited
“The value of an inherited tag is overwritten by sensitive data classification.”
↩︎ Checkpoint