Bird
Raised Fist0
Snowflakecloud~10 mins

Data classification and tagging in Snowflake - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - Data classification and tagging
Start: Data arrives
↓
Identify data type
↓
Assign classification label
↓
Apply tags/metadata
↓
Store data with tags
↓
Use tags for access control, search, and governance
↓
End
Data is first identified by type, then labeled with classification and tagged with metadata before storage, enabling governance and access control.
Execution Sample
Snowflake
CREATE TAG IF NOT EXISTS classification;

CREATE OR REPLACE TABLE customer_data (
  id INT,
  name STRING,
  email STRING
);

ALTER TABLE customer_data SET TAG classification = 'confidential';
Creates a table and applies a classification tag to it.
Process Table
StepActionObjectTag/Classification AppliedResult
1Create tablecustomer_dataNoneTable created with columns id, name, email
2Apply tagcustomer_dataclassification = 'confidential'Tag applied successfully
3Query tagscustomer_dataclassificationReturns 'confidential'
4Use tag for access controlcustomer_dataclassification = 'confidential'Access restricted to authorized users
5ExitN/AN/AProcess complete
💡 All steps completed; data classified and tagged for governance
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
customer_data tableNot createdCreated with columnsTagged as confidentialTag confirmedReady for controlled access
Key Moments - 2 Insights
Why do we apply tags after creating the table and not before?
Tags are metadata applied to existing objects; as shown in execution_table step 2, the table must exist before tags can be assigned.
How does tagging affect data access?
As in step 4, tags like 'confidential' can be used to enforce access control policies, restricting who can see the data.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what tag is applied to the customer_data table at step 2?
Aclassification = 'public'
Bclassification = 'internal'
Cclassification = 'confidential'
Dclassification = 'restricted'
💡 Hint
Check the 'Tag/Classification Applied' column at step 2 in the execution_table.
At which step is the table confirmed to have the classification tag?
AStep 3
BStep 2
CStep 1
DStep 4
💡 Hint
Look for the step where tags are queried and confirmed in the execution_table.
If the tag 'classification = confidential' was not applied, what would change in the execution table?
AStep 2 would show 'Tag applied successfully'
BStep 4 would not restrict access based on classification
CStep 3 would return 'confidential'
DStep 1 would fail to create the table
💡 Hint
Consider how tags affect access control as shown in step 4.
Concept Snapshot
Data classification and tagging in Snowflake:
- Create data objects (tables, views)
- Apply tags as metadata (e.g., classification='confidential')
- Use tags for governance and access control
- Tags help organize and protect data
- Tags are applied after object creation
Full Transcript
Data classification and tagging is a process where data objects like tables are first created, then labeled with classification tags such as 'confidential'. These tags are metadata that help manage data access and governance. In Snowflake, you create a table, then apply tags using ALTER TABLE commands. Tags can be queried to confirm their presence and used to enforce access controls. This process ensures data is properly organized and protected according to its sensitivity.

Practice

(1/5)
1. What is the main purpose of data classification and tagging in Snowflake?
easy
A. To speed up query performance by indexing data
B. To convert data into different file formats
C. To automatically delete old data after a set time
D. To organize and protect data by labeling it with tags

Solution

  1. Step 1: Understand data classification and tagging

    Data classification and tagging help label data to organize and protect it.
  2. Step 2: Identify the purpose in Snowflake context

    Tags are used to mark data for governance and security, not for performance or deletion.
  3. Final Answer:

    To organize and protect data by labeling it with tags -> Option D
  4. Quick Check:

    Data classification = Organize and protect data [OK]
Hint: Tags label data to organize and protect it [OK]
Common Mistakes:
  • Confusing tagging with indexing for performance
  • Thinking tags delete data automatically
  • Assuming tags change data format
2. Which of the following is the correct syntax to create a tag in Snowflake?
easy
A. CREATE TAG tag_name COMMENT = 'description';
B. CREATE TAG tag_name WITH 'description';
C. MAKE TAG tag_name COMMENT 'description';
D. NEW TAG tag_name SET COMMENT = 'description';

Solution

  1. Step 1: Recall Snowflake tag creation syntax

    The correct syntax uses CREATE TAG followed by the tag name and COMMENT clause.
  2. Step 2: Compare options with syntax

    Only CREATE TAG tag_name COMMENT = 'description'; matches the correct syntax: CREATE TAG tag_name COMMENT = 'description';
  3. Final Answer:

    CREATE TAG tag_name COMMENT = 'description'; -> Option A
  4. Quick Check:

    CREATE TAG ... COMMENT = ... is correct syntax [OK]
Hint: Use CREATE TAG with COMMENT = 'text' [OK]
Common Mistakes:
  • Using MAKE or NEW instead of CREATE
  • Missing equal sign in COMMENT clause
  • Using WITH instead of COMMENT
3. Given the following commands, what will be the result of querying the tags on the customers table?
CREATE TAG pii COMMENT = 'Personally Identifiable Information';
ALTER TABLE customers SET TAG pii = 'true';
SHOW TAGS ON TABLE customers;
medium
A. It will show the tag 'pii' with value 'true' assigned to the customers table
B. It will show an error because tags cannot be set on tables
C. It will show the tag 'pii' but with no value assigned
D. It will show no tags because SHOW TAGS is invalid syntax

Solution

  1. Step 1: Understand tag creation and assignment

    The tag 'pii' is created and then assigned to the 'customers' table with value 'true'.
  2. Step 2: Check SHOW TAGS syntax and output

    SHOW TAGS ON TABLE customers; lists tags assigned to the table, showing 'pii' = 'true'.
  3. Final Answer:

    It will show the tag 'pii' with value 'true' assigned to the customers table -> Option A
  4. Quick Check:

    SHOW TAGS ON TABLE shows assigned tags [OK]
Hint: SHOW TAGS ON TABLE lists assigned tags and values [OK]
Common Mistakes:
  • Thinking tags cannot be assigned to tables
  • Assuming SHOW TAGS syntax is invalid
  • Expecting tags without values to appear
4. You run the following command but get an error:
ALTER TABLE orders SET TAG sensitive = 'yes';

What is the most likely cause of the error?
medium
A. ALTER TABLE cannot be used to set tags
B. The value 'yes' is not allowed for tags
C. The tag 'sensitive' was not created before assigning it
D. Tags can only be assigned to columns, not tables

Solution

  1. Step 1: Check if tag exists before assignment

    Tags must be created with CREATE TAG before assigning to tables or columns.
  2. Step 2: Analyze error cause

    If 'sensitive' tag was not created, assigning it causes an error.
  3. Final Answer:

    The tag 'sensitive' was not created before assigning it -> Option C
  4. Quick Check:

    Tags must exist before assignment [OK]
Hint: Create tags before assigning them [OK]
Common Mistakes:
  • Assuming any value is invalid
  • Thinking ALTER TABLE can't set tags
  • Believing tags only apply to columns
5. You want to classify columns in a payments table as either 'confidential' or 'public' using tags. Which approach correctly applies tags to columns and supports data governance?
hard
A. Create tags and assign them to database schemas instead of columns
B. Create tags 'confidential' and 'public', then assign them to each column with ALTER TABLE ... ALTER COLUMN ... SET TAG
C. Use column comments instead of tags to classify data sensitivity
D. Create tags and assign them only to the table, not columns, to simplify management

Solution

  1. Step 1: Understand tagging granularity

    Tags can be assigned to columns to classify data precisely, supporting governance.
  2. Step 2: Identify correct tagging method

    Using ALTER TABLE ... ALTER COLUMN ... SET TAG applies tags to columns, enabling classification.
  3. Final Answer:

    Create tags 'confidential' and 'public', then assign them to each column with ALTER TABLE ... ALTER COLUMN ... SET TAG -> Option B
  4. Quick Check:

    Column-level tags enable precise data classification [OK]
Hint: Tag columns directly for precise classification [OK]
Common Mistakes:
  • Tagging only tables loses column-level detail
  • Using comments instead of tags for governance
  • Assigning tags to schemas instead of columns
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard