Created
May 1, 2023 12:29
-
-
Save daanalytics/919e9a35b2cc0e788179e0a30e080dc2 to your computer and use it in GitHub Desktop.
Create a Dynamic Masking Policy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create a Dynamic Masking Policy | |
CREATE OR REPLACE MASKING POLICY email_mask AS (val string) returns string -> | |
CASE | |
WHEN current_role() IN ('TASTY_ADMIN') | |
THEN VAL | |
WHEN current_role() IN ('TASTY_TEST_ROLE') | |
THEN regexp_replace(val,'.+\@','*****@') -- leave email domain visible | |
ELSE '*********' | |
END | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment