QuestionQ234

VerifiedData Governance & Quality

A data engineer must apply row-level security to main.secure.events(region STRING, event_id STRING). Members of the account group all_regions must be able to view every row. All other users must be able to view only rows where region = 'EU'.

Which SQL sequence meets this requirement?

Explanation

Unity Catalog row-level security is enforced by a SQL UDF that returns BOOLEAN and is bound to the table with ALTER TABLE ... SET ROW FILTER <function> ON (<column>). The function main.secure.region_filter(region STRING) returns true when is_account_group_member('all_regions') is true and otherwise only when region = 'EU', and attaching it to main.secure.events on the region column enforces exactly the required visibility. Creating the function alone enforces nothing, row filters are set on tables rather than through ALTER VIEW, and SET MASK defines a column mask, which redacts column values instead of filtering rows.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!