Account Management and Data Governance · Topic 6 of 8
Data Masking, Row Access, Tagging and Privacy Policies
Use masking policies for column-level security, row access policies for row-level security, object tags to classify data and privacy policies for sharing.
- 5 min
- Column-level security: dynamic data masking and external tokenization through masking policies.
- Row-level security: row access policies that return BOOLEAN, often using a mapping table.
- One masking policy per column; one row access policy per table or view; row access is evaluated first.
What it is
Data governance is how an organization knows what data it holds, who can see it and how it is used. In Snowflake these features are grouped under Snowflake Horizon Catalog, which covers security, discovery, lineage and privacy.
Roles decide which objects a user reaches. Governance policies go further and decide what the data inside those objects looks like to each user, at query time, without copying or changing the stored data.
All features on this page need Enterprise Edition or higher.
How it works
Policy types at a glance
| Feature | Protects | Object | Typical use |
|---|---|---|---|
| Dynamic data masking | Column values | Masking policy | Show full email to HR, masked email to analysts |
| External tokenization | Column values | Masking policy calling an external function | Detokenize values held by a third-party tokenization provider |
| Row access policy | Which rows return | Row access policy | Each sales manager sees only their region |
| Object tagging | Labels on objects | Tag | Mark PII columns, cost centers, data owners |
| Aggregation policy | Row level output | Aggregation policy | Allow only grouped results with a minimum group size |
| Projection policy | A column in output | Projection policy | Allow filtering on a column but not selecting it |
| Privacy policy | Whole table | Privacy policy | Differential privacy with a privacy budget |
Column-level security: masking policies
Column-level security in Snowflake means dynamic data masking and external tokenization. A masking policy is a schema-level object with a body that returns either the real value or a masked one, based on conditions.
CREATE MASKING POLICY email_mask AS (val STRING) RETURNS STRING ->
CASE WHEN IS_ROLE_IN_SESSION('HR') THEN val ELSE '*** MASKED ***' END;
ALTER TABLE customers MODIFY COLUMN email SET MASKING POLICY email_mask;
The input and return data types must match. A column can have only one masking policy, and one policy can be reused on many columns.
Masking happens at query time: the stored data is unchanged, and the owner of the table cannot bypass the policy unless the policy conditions allow it. A conditional masking policy can also look at other columns in the same row.
Row-level security: row access policies
Row-level security uses a row access policy. Its body returns TRUE or FALSE for each row, and only rows that return TRUE appear in the result.
A policy can compare CURRENT_ROLE() to a value, call IS_ROLE_IN_SESSION() to respect the role hierarchy, or look up a mapping table of roles and allowed values. It is evaluated with the policy owner's privileges, so users do not need access to the mapping table.
A table or view can have one row access policy at a time. When a table has both a row access policy and masking policies, the row access policy is evaluated first.
Object tagging
A tag is a schema-level object that stores a key and a string value on another object, such as pii = 'email' on a column. ALLOWED_VALUES can restrict the values a tag accepts.
Tags are inherited down the object hierarchy, so a tag set on a schema applies to its tables and columns unless overridden. Query tag assignments with the TAG_REFERENCES view in ACCOUNT_USAGE or the INFORMATION_SCHEMA table function.
Tag-based masking assigns a masking policy to a tag. Every column that carries the tag, and matches the policy's data type, is masked automatically, which scales far better than setting policies column by column.
Sensitive data classification can detect personal data and set the system tags SNOWFLAKE.CORE.SEMANTIC_CATEGORY and SNOWFLAKE.CORE.PRIVACY_CATEGORY for you.
When a question asks how to protect hundreds of PII columns, including columns that will be added later, the answer is tag-based masking, not one masking policy per column.
Privacy policies
Aggregation policies force queries to aggregate data into groups of at least a minimum size, so no individual row is returned. Projection policies let a column be used in WHERE clauses and joins while blocking it from the SELECT output.
A privacy policy applies differential privacy to a table or view. It assigns a privacy budget to users; queries must aggregate, Snowflake adds statistical noise to results, and once a user's budget is used up, their queries fail until it refreshes.
These features suit data clean rooms and sharing, where a partner may analyze data but must never identify an individual.
Common mistakes
Thinking masking changes stored data. Masking is applied when a query runs. The data in storage stays intact, so users with the right role still see real values.
Using a secure view where a policy is meant. Secure views work, but policies attach once to the column or table and protect every query path, including new views.
Putting the same column in both policy types. A column cannot appear in both a row access policy signature and a masking policy signature.
Forgetting the edition. Masking, row access policies, tagging and privacy policies need Enterprise Edition or higher.
What to remember for the exam
- Column-level security: dynamic data masking and external tokenization through masking policies.
- Row-level security: row access policies that return BOOLEAN, often using a mapping table.
- One masking policy per column; one row access policy per table or view; row access is evaluated first.
- Use IS_ROLE_IN_SESSION to respect role inheritance inside policies.
- Tags are inherited down the hierarchy; tag-based masking protects every tagged column.
- Aggregation and projection policies limit output; privacy policies add differential privacy with a budget.
A masking policy that tests CURRENT_ROLE() with an exact name ignores inherited roles. A user whose role inherits HR would still see masked data unless the policy uses IS_ROLE_IN_SESSION.
Check yourself
Which feature shows each sales manager only the rows for their own region from one shared table?
A row access policy, usually with a mapping table of roles and regions.
How can a team mask every current and future PII column with minimal work?
Tag the columns and assign a masking policy to the tag, so tag-based masking protects each tagged column.
What does a privacy policy add to a table?
Differential privacy: queries must aggregate, results include noise, and each user's privacy budget limits how much they can learn.
Topic 6 of 8 in Account Management and Data Governance
Test yourself on Account Management and Data Governance
The full Snowflake SnowPro Core COF-C03 question bank has 845 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.