Data Classification in Snowflake
1️⃣ What is Data Classification in Snowflake?
Snowflake's Data Classification feature automatically scans your tables and views, detects patterns of sensitive data, and applies system tags for robust governance and compliance. For example:
📂 SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES
Classification reveals:
- Meaning: What is the data?
- Sensitivity: How risky is it?
- Compliance Context: PII, PCI, PHI, etc.
This enables effective governance, masking, and auditing for your data estate.
2️⃣ Why is Data Classification Important?
- Governance: Control data access confidently across your organization.
- Compliance: Meet regulatory needs (GDPR, HIPAA, PCI-DSS) efficiently.
- Risk Reduction: Quickly spot and protect PII before it leaks.
- Policy Enablement: Powers automated masking and tokenization.
- Auditing: Maintain a traceable, compliant record of sensitive data.
Key Benefits:
- Rapid PII detection to trigger masking.
- Stronger compliance for global standards.
- Unified metadata to empower data teams.
3️⃣ Tags Applied to Columns
Classification applies two official system tags to columns:
| Tag | Purpose | Example Values |
|---|---|---|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY | What data represents | EMAIL, NAME, PHONE_NUMBER |
SNOWFLAKE.CORE.PRIVACY_CATEGORY | Data sensitivity | IDENTIFIER, SENSITIVE, INSENSITIVE |
Tags persist on columns and drive governance.
4️⃣ How Does It Work? (Workflow & Example)
Run Classification:
CALL SYSTEM$CLASSIFY('SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES', {'auto_tag': TRUE});
Snowflake’s process:
- Analyzes column values and names.
- Detects semantic patterns (e.g., email, SSN, phone).
- Assigns privacy sensitivity.
- Adds context for compliance frameworks.
Example Classification Output:
| Column | Semantic Category | Privacy Category | Security Category |
|---|---|---|---|
| IDENTIFIER | PII | ||
| CREDIT_CARD | CREDIT_CARD_NUMBER | IDENTIFIER | PCI |
| BLOOD_GROUP | HEALTH_DATA | SENSITIVE | PHI |
| CITY | CITY | INSENSITIVE | NONE |
Notes:
The Security Category appears in classification results for compliance context, not as a tag—it supports mapping to regulations and audit grouping.
Tags vs Scan Output
- Tags on columns:
SEMANTIC_CATEGORY,PRIVACY_CATEGORY - Security Category: Only appears in scan report for compliance reference.
Why “Security Category” is not a tag:
It’s derived metadata, not system-enforced, and may evolve as compliance standards change.
How to Use Security Category:
- Compliance reporting
- Masking policy planning
- Building risk dashboards
5️⃣ Quick Process Visualization
✅ Key Features Summary
- Automated Detection: No manual scanning.
- Persistent Tags: Semantic & privacy tags stay on columns.
- Security Category: Context only, not a tag.
- Compliance Ready: GDPR, HIPAA, CCPA, PCI-DSS.
- Governance Integration: Works with masking, row access policies, and audit processes.
6️⃣ Demo Table Walkthrough
Create Table + Data
CREATE OR REPLACE TABLE SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES (
employee_id BIGINT,
first_name VARCHAR,
last_name VARCHAR,
department VARCHAR,
hire_date DATE,
email VARCHAR,
phone VARCHAR,
ssn VARCHAR,
credit_card VARCHAR,
address VARCHAR,
salary NUMBER(10,2)
);
INSERT INTO SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES VALUES
(1, 'John', 'Doe', 'Finance', '2015-03-15', 'john.doe@example.com', '123-456-7890', '123-45-6789', '4111111111111111', '123 Main St, NY', 85000),
(2, 'Jane', 'Smith', 'HR', '2017-07-22', 'jane.smith@example.com', '987-654-3210', '987-65-4321', '5500000000000004', '456 Park Ave, NY', 65000),
(3, 'Alice', 'Brown', 'IT', '2019-01-10', 'alice.brown@example.com', '555-222-1111', '111-22-3333', '340000000000009', '789 Broadway, NY', 92000),
(4, 'Bob', 'Johnson', 'Marketing', '2020-11-05', 'bob.johnson@example.com', '444-333-2222', '222-33-4444', '30000000000004', '321 Wall St, NY', 72000);
Classify & Auto-Tag
CALL SYSTEM$CLASSIFY('SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES', {'auto_tag': true});
7️⃣ Inspect Results
A) Column Tag View
SELECT COLUMN_NAME, TAG_NAME, TAG_VALUE
FROM TABLE(
SFTRAINING_EMP_DB.INFORMATION_SCHEMA.TAG_REFERENCES_ALL_COLUMNS('SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES', 'TABLE')
)
WHERE TAG_NAME IN ('SEMANTIC_CATEGORY','PRIVACY_CATEGORY')
ORDER BY COLUMN_NAME, TAG_NAME;
Example Output:
| COLUMN_NAME | TAG_NAME | TAG_VALUE |
|---|---|---|
| PRIVACY_CATEGORY | IDENTIFIER | |
| SEMANTIC_CATEGORY | ||
| FIRST_NAME | PRIVACY_CATEGORY | IDENTIFIER |
| FIRST_NAME | SEMANTIC_CATEGORY | NAME |
| SALARY | PRIVACY_CATEGORY | SENSITIVE |
| SALARY | SEMANTIC_CATEGORY | SALARY |
Why multiple tags?
Each column gets:
- PRIVACY_CATEGORY: Sensitivity (e.g., IDENTIFIER, SENSITIVE)
- SEMANTIC_CATEGORY: Actual type (e.g., EMAIL, NAME, SALARY)
A column can be both PII and specifically an email address. Some columns may have only the privacy category if semantic detection is not possible.
B) JSON Classification Result
SELECT SYSTEM$GET_CLASSIFICATION_RESULT('SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES') AS result;
Get semantic_category, privacy_category, confidence, coverage per column.
8️⃣ Snapshot “Before” (Baseline)
CREATE OR REPLACE TABLE DEMO_DB.PUBLIC.classification_before AS
SELECT COLUMN_NAME, TAG_NAME, TAG_VALUE
FROM TABLE(
SFTRAINING_EMP_DB.INFORMATION_SCHEMA.TAG_REFERENCES_ALL_COLUMNS('SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES', 'TABLE')
)
WHERE TAG_NAME IN ('SEMANTIC_CATEGORY','PRIVACY_CATEGORY')
ORDER BY COLUMN_NAME, TAG_NAME;
9️⃣ Manual Tag Corrections (Override)
-- Override tags for accurate classification
ALTER TABLE DEMO_DB.PUBLIC.CUSTOMER_360
ALTER COLUMN EMAIL
SET TAG "SNOWFLAKE.CORE.SEMANTIC_CATEGORY" = 'EMAIL_ADDRESS',
"SNOWFLAKE.CORE.PRIVACY_CATEGORY" = 'IDENTIFIER';
-- Remove a tag if required
ALTER TABLE DEMO_DB.PUBLIC.CUSTOMER_360
ALTER COLUMN NOTES
UNSET TAG "SNOWFLAKE.CORE.SEMANTIC_CATEGORY";
Reclassify by re-running SYSTEM$CLASSIFY after manual overrides.
🔁 Re-Inspect & Snapshot “After”
CALL SYSTEM$CLASSIFY('DEMO_DB.PUBLIC.CUSTOMER_360', {'auto_tag': true});
CREATE OR REPLACE TABLE DEMO_DB.PUBLIC.classification_after AS
SELECT COLUMN_NAME, TAG_NAME, TAG_VALUE
FROM TABLE(
DEMO_DB.INFORMATION_SCHEMA.TAG_REFERENCES_ALL_COLUMNS('DEMO_DB.PUBLIC.CUSTOMER_360', 'TABLE')
)
WHERE TAG_NAME IN ('SEMANTIC_CATEGORY','PRIVACY_CATEGORY');
🧭 Compare Before vs After
SELECT
COALESCE(b.COLUMN_NAME, a.COLUMN_NAME) AS COLUMN_NAME,
COALESCE(b.TAG_NAME, a.TAG_NAME) AS TAG_NAME,
b.TAG_VALUE AS BEFORE_VALUE,
a.TAG_VALUE AS AFTER_VALUE
FROM DEMO_DB.PUBLIC.classification_before b
FULL OUTER JOIN DEMO_DB.PUBLIC.classification_after a
ON b.COLUMN_NAME = a.COLUMN_NAME
AND b.TAG_NAME = a.TAG_NAME
ORDER BY COLUMN_NAME, TAG_NAME;
🧹 Quick Audit Filters
-- Show only IDENTIFIER columns
SELECT COLUMN_NAME
FROM TABLE(
DEMO_DB.INFORMATION_SCHEMA.TAG_REFERENCES_ALL_COLUMNS('DEMO_DB.PUBLIC.CUSTOMER_360', 'TABLE')
)
WHERE TAG_NAME = 'PRIVACY_CATEGORY' AND TAG_VALUE = 'IDENTIFIER'
ORDER BY COLUMN_NAME;
-- Show all columns by semantic
SELECT COLUMN_NAME, TAG_VALUE AS SEMANTIC
FROM TABLE(
DEMO_DB.INFORMATION_SCHEMA.TAG_REFERENCES_ALL_COLUMNS('DEMO_DB.PUBLIC.CUSTOMER_360', 'TABLE')
)
WHERE TAG_NAME = 'SEMANTIC_CATEGORY'
AND TAG_VALUE IN ('EMAIL','PHONE_NUMBER','NAME')
ORDER BY COLUMN_NAME;
🛡️ Tag-Based Masking (Quickstart)
-- Example masking policy for IDENTIFIERS
CREATE OR REPLACE MASKING POLICY DEMO_DB.PUBLIC.mask_identifiers AS (val STRING) RETURNS STRING ->
CASE
WHEN CURRENT_ROLE() IN ('DATA_STEWARD', 'ACCOUNTADMIN') THEN val
ELSE '***MASKED***'
END;
Attach masking policy to PRIVACY_CATEGORY via the UI/SQL for automated protection.
🗂️ Supported & Unsupported Data Types
| Supported (✅) | Not Supported (❌) |
|---|---|
| VARCHAR, STRING | BLOB, VARIANT, ARRAY |
| Numeric patterns, DOB | VECTOR, OBJECT, GEOGRAPHY |
Classification works on tables, external/secure/materialized views. Only works for providers on shared tables.
⚡ Advanced Workflows
- Object-Level Profiles: Set classification at database/schema level; profiles auto-monitor new and existing objects.
- Custom Classifiers: Define custom semantic patterns for domain/industry needs, leveraging regex.
- Regular Audits: Schedule schema-wide classification for ongoing governance.
📝 Best Practices
- Prioritize high-impact tables (HR, Finance, Customer).
- Ensure descriptive column names and castable data types.
- Regularly audit and snapshot tag results for compliance records.
- Employ custom tags and classifiers as needed.
🚀 Latest Enhancements
- Serverless Large-Scale Classification: Scale-out with native and custom patterns.
- Enhanced Classifiers: Improved geo-detection (US/UK/AUS/CA/NZ/JP), payment cards, names, latitude/longitude.
- Snowsight UI Integration: One-click schema-wide auto-tagging.
🏁 Recap & 2025 Improvement Highlights
| Feature | Impact/Recommendation |
|---|---|
| Serverless auto-classification | Easier scaling, lower complexity |
| Schema/database-level profiles | Automates monitoring, fine-tuned overrides |
| Enhanced country classifiers | Improved accuracy for global organizations |
| Custom classifiers/tag maps | Org/industry-specific compliance |
| Tag-based masking integration | Fine-grained, policy-driven security |
| Snowsight UI classification | Fast workflow & instant reviews |
Snowflake’s data classification enables scalable, compliant, and auditable data protection—modern, automated, and deeply integrated into governance and masking policies.
Summary:
Start by classifying, auto-tagging, and inspecting your data. Override as needed, re-scan, snapshot changes, and enforce policies using tags—all for confident, compliant, and secure data management in Snowflake.
Here’s your revised step-by-step guide, neatly arranged for clarity and realism. It walks users through creating a table with sensitive fields, performing classification, inspecting, overriding, and comparing results — all using practical examples and simple explanations.
1️⃣ Create a Realistic Employees Table
CREATE OR REPLACE TABLE SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES (
employee_id BIGINT,
first_name VARCHAR,
last_name VARCHAR,
department VARCHAR,
hire_date DATE,
email VARCHAR,
phone VARCHAR, -- Sensitive
ssn VARCHAR, -- Sensitive
credit_card VARCHAR, -- Sensitive
address VARCHAR, -- Sensitive
salary NUMBER(10,2) -- Sensitive
);
2️⃣ Insert Sample Data (with sensitive patterns)
INSERT INTO SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES VALUES
(1, 'John', 'Doe', 'Finance', '2015-03-15', 'john.doe@example.com', '123-456-7890', '123-45-6789', '4111111111111111', '123 Main St, NY', 85000),
(2, 'Jane', 'Smith', 'HR', '2017-07-22', 'jane.smith@example.com', '987-654-3210', '987-65-4321', '5500000000000004', '456 Park Ave, NY', 65000),
(3, 'Alice', 'Brown', 'IT', '2019-01-10', 'alice.brown@example.com', '555-222-1111', '111-22-3333', '340000000000009', '789 Broadway, NY', 92000),
(4, 'Bob', 'Johnson', 'Marketing', '2020-11-05', 'bob.johnson@example.com', '444-333-2222', '222-33-4444', '30000000000004', '321 Wall St, NY', 72000);
3️⃣ Run Classification & Auto-Tag Columns
-- Classify and apply tags (semantic + privacy)
CALL SYSTEM$CLASSIFY('SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES', {'auto_tag': true});
-- Optional: Specify sample_count or run schema-wide classification
-- CALL SYSTEM$CLASSIFY('SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES', {'sample_count': 2000, 'auto_tag': true});
-- CALL SYSTEM$CLASSIFY_SCHEMA('SFTRAINING_EMP_DB.EMP_HR', {'auto_tag': true});
4️⃣ Inspect Classification Results
A) Column-level Tag View
SELECT COLUMN_NAME, TAG_NAME, TAG_VALUE
FROM TABLE(
SFTRAINING_EMP_DB.INFORMATION_SCHEMA.TAG_REFERENCES_ALL_COLUMNS('SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES', 'TABLE')
)
WHERE TAG_NAME IN ('SEMANTIC_CATEGORY','PRIVACY_CATEGORY')
ORDER BY COLUMN_NAME, TAG_NAME;
Example Output Table:
| COLUMN_NAME | TAG_NAME | TAG_VALUE |
|---|---|---|
| PRIVACY_CATEGORY | IDENTIFIER | |
| SEMANTIC_CATEGORY | ||
| FIRST_NAME | PRIVACY_CATEGORY | IDENTIFIER |
| FIRST_NAME | SEMANTIC_CATEGORY | NAME |
| LAST_NAME | PRIVACY_CATEGORY | IDENTIFIER |
| LAST_NAME | SEMANTIC_CATEGORY | NAME |
| SALARY | PRIVACY_CATEGORY | SENSITIVE |
| SALARY | SEMANTIC_CATEGORY | SALARY |
Why Multiple Tags per Column?
- PRIVACY_CATEGORY: Indicates sensitivity (e.g., IDENTIFIER for PII, SENSITIVE for health/financial data).
- SEMANTIC_CATEGORY: Describes the actual type (e.g., EMAIL, NAME, SALARY).
A column may be both an identifier and specifically an email address.
Example — Single tag column:
| COLUMN_NAME | TAG_NAME | TAG_VALUE |
|---|---|---|
| CUSTOMER_NAME | PRIVACY_CATEGORY | IDENTIFIER |
If a column gets only one tag, Snowflake was unable to semantically classify it further.
B) Rich JSON Classification Result
SELECT SYSTEM$GET_CLASSIFICATION_RESULT('SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES') AS result;
- Provides semantic_category, privacy_category, confidence level, and coverage for each column.
- Info Schema = near instant; Account Usage views (like DATA_CLASSIFICATION_LATEST) ≈3hr latency.
5️⃣ Snapshot Current Classification ("Before")
CREATE OR REPLACE TABLE DEMO_DB.PUBLIC.classification_before AS
SELECT COLUMN_NAME, TAG_NAME, TAG_VALUE
FROM TABLE(
SFTRAINING_EMP_DB.INFORMATION_SCHEMA.TAG_REFERENCES_ALL_COLUMNS('SFTRAINING_EMP_DB.EMP_HR.DC_EMPLOYEES', 'TABLE')
)
WHERE TAG_NAME IN ('SEMANTIC_CATEGORY','PRIVACY_CATEGORY')
ORDER BY COLUMN_NAME, TAG_NAME;
6️⃣ Manual Tag Corrections (Override)
Examples:
- Mark FULL_NAME column as a NAME (Identifier)
- Confirm SALARY as SALARY (Sensitive)
- Set EMAIL as EMAIL (Identifier)
-- Override tags for accurate classification
ALTER TABLE DEMO_DB.PUBLIC.CUSTOMER_360
ALTER COLUMN EMAIL
SET TAG "SNOWFLAKE.CORE.SEMANTIC_CATEGORY" = 'EMAIL_ADDRESS',
"SNOWFLAKE.CORE.PRIVACY_CATEGORY" = 'IDENTIFIER';
-- Remove a tag for over-classified columns
ALTER TABLE DEMO_DB.PUBLIC.CUSTOMER_360
ALTER COLUMN NOTES
UNSET TAG "SNOWFLAKE.CORE.SEMANTIC_CATEGORY";
Tip: Want to re-classify? Just re-run SYSTEM$CLASSIFY after making manual changes.
7️⃣ Re-Inspect & Snapshot "After"
-- Optionally, re-run classification after overrides to update tags
CALL SYSTEM$CLASSIFY('DEMO_DB.PUBLIC.CUSTOMER_360', {'auto_tag': true});
-- Save the after snapshot
CREATE OR REPLACE TABLE DEMO_DB.PUBLIC.classification_after AS
SELECT COLUMN_NAME, TAG_NAME, TAG_VALUE
FROM TABLE(
DEMO_DB.INFORMATION_SCHEMA.TAG_REFERENCES_ALL_COLUMNS('DEMO_DB.PUBLIC.CUSTOMER_360', 'TABLE')
)
WHERE TAG_NAME IN ('SEMANTIC_CATEGORY','PRIVACY_CATEGORY');
8️⃣ Compare Before vs After Classification
SELECT
COALESCE(b.COLUMN_NAME, a.COLUMN_NAME) AS COLUMN_NAME,
COALESCE(b.TAG_NAME, a.TAG_NAME) AS TAG_NAME,
b.TAG_VALUE AS BEFORE_VALUE,
a.TAG_VALUE AS AFTER_VALUE
FROM DEMO_DB.PUBLIC.classification_before b
FULL OUTER JOIN DEMO_DB.PUBLIC.classification_after a
ON b.COLUMN_NAME = a.COLUMN_NAME
AND b.TAG_NAME = a.TAG_NAME
ORDER BY COLUMN_NAME, TAG_NAME;
Summary
- Create a table with realistic sensitive fields.
- Insert data with real-world patterns.
- Classify columns and auto-tag for privacy and semantics.
- Inspect tags at both column and JSON report level.
- Snapshot results before and after manual overrides.
- Compare tags to audit changes and ensure accuracy.
This process provides full transparency for sensitive data discovery, governance, and compliance in Snowflake.