Databricks Data Engineer Associate · Section 7 · 15% of the exam
Understand column-level masking and row-level security to restrict data visibility based on user groups.
One of the objectives of the Databricks Certified Data Engineer Associate exam, in the section “Governance and Security”. Here is what it covers, the points to remember and a question to try.
What it covers
Row filters hide rows and column masks transform values at query time, using SQL UDFs that check who is querying. This lesson covers the SQL to attach and remove them, identity functions, the older dynamic-view pattern, required privileges, and the limitations that show up in exam questions.
Points to remember
- Row filter = SQL UDF returning BOOLEAN, attached with
ALTER TABLE t SET ROW FILTER fn ON (col, …); FALSE or NULL hides the row; one filter per table. - Column mask = SQL UDF whose first parameter is the column, attached with
ALTER TABLE t ALTER COLUMN c SET MASK fn [USING COLUMNS (…)]; one mask per column. - Detach with
DROP ROW FILTERorALTER COLUMN c DROP MASKbefore dropping the function, or the table becomes inaccessible. - Use
is_account_group_member()for account groups andcurrent_user()for the user's email;is_member()is workspace-local and legacy. - Attaching a filter or mask needs
EXECUTEon the function plus table ownership orMANAGE+SELECTon the table.
Try a question
A column mask function on address needs the row's country value as well to decide whether to redact. How is country passed to the function?
- A
ALTER TABLE t ALTER COLUMN address SET MASK fn USING COLUMNS (country) - B
ALTER TABLE t ALTER COLUMN address SET MASK fn ON (address, country) - C
ALTER TABLE t SET MASK fn ON (address, country) - DMasks receive just the masked column, so look up
countryinside the function with a subquery
Show the answer
A. The masked column is bound automatically to the first parameter, and additional columns or constant literals are passed in order with USING COLUMNS (…). The ON (…) clause belongs to row filters.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson Row Filters & Column Masks teaches this objective (about 45 minutes), and 12 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.
More in this section
- Differentiate between managed and external tables in Unity Catalog and perform basic operations (create, modify, delete, and convert between managed and external tables) on them.
- Configure access controls using the UI and SQL by applying GRANT, REVOKE, and DENY privileges to principals (users, groups, and service principals) at appropriate levels of the security hierarchy.
- Understand Unity Catalog ABAC policies to centrally control row-level filtering and column masking for sensitive data.