Creates a masking policy, which allows dynamically transforming or masking column values for specific users or roles when they query a table. Syntax:Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
UPDATE Clause
TheUPDATE clause specifies which columns to mask and how to transform them. You can mask multiple columns in a single policy.
Examples:
- Simple masking:
UPDATE email = '***masked***' - Partial masking:
UPDATE email = concat(substring(email, 1, 3), '***@***.***') - Hash-based masking:
UPDATE email = concat('masked_', substring(hex(cityHash64(email)), 1, 8)) - Multiple columns:
UPDATE email = '***@***.***', phone = '***-***-****'
WHERE Clause
The optionalWHERE clause allows conditional masking based on row values. Only rows matching the condition will have the masking applied.
Example:
TO Clause
In theTO section, specify which users and roles the policy should apply to.
TO user1, user2: Apply to specific users/rolesTO ALL: Apply to all usersTO ALL EXCEPT user1, user2: Apply to all users except specified ones
Unlike row policies, masking policies do not affect users who don’t have the policy applied. If no masking policy applies to a user, they see the original data.
PRIORITY Clause
When multiple masking policies target the same column for a user, thePRIORITY clause determines the application order. Policies are applied in order from highest to lowest priority.
Default priority is 0. Policies with the same priority are applied in an undefined order.
Example:
Performance Considerations
- Masking policies may impact query performance depending on expression complexity
- Some optimizations may be disabled for tables with active masking policies