Created
April 26, 2023 10:19
-
-
Save daanalytics/99ac06957b0032c037e96f45e017e3e2 to your computer and use it in GitHub Desktop.
Create Row Acces 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 OR REPLACE ROW ACCESS POLICY customer_loyalty_city_row_policy | |
as (city VARCHAR) RETURNS BOOLEAN -> | |
CURRENT_ROLE() IN (<ROLE_NAME1>,<ROLE_NAME2>) -- e.g. 'TASTY_ADMIN','TASTY_DEV' | |
OR EXISTS | |
( SELECT rp.role_name | |
FROM frostbyte_tasty_bytes.data_governance.customer_loyalty_city_policy_mapping rp | |
WHERE rp.role_name = CURRENT_ROLE() | |
AND rp.city_value = city | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment