Row filters, column masks, ABAC, and personal data
Databricks Data Engineer Professional · Lesson 17 of 21 · 2:15:17
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Databricks Certified Data Engineer Professional exam. In this lesson: row filters, column masks, and attribute-based access control (ABAC), anonymizing personal data, and finding personal data with data classification. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Personal data everywhere
Customer emails and phone numbers sit in the silver tables of Quayside Eats, and every analyst can see them. Marketing wants to count customers per city without knowing who they are, and nobody can say which of four hundred tables hold personal data. This lesson covers row filters, column masks, and ABAC policies, anonymization methods, and finding personal data.
Filters, masks, and ABAC
A row filter is a SQL function attached to a table, which decides for each row whether the current user may see it, and a column mask is a function that returns the real value or a masked one. Functions like is_account_group_member make them depend on the groups of the user who runs the query. Attached table by table, with alter table set row filter, or alter column set mask, they become hard to maintain across hundreds of tables. Attribute based access control, or ABAC, attaches policies to a catalog or a schema instead, and applies them to every table or column that carries a governed tag, including tables created later. These policies protect streaming tables and batch tables alike.
Anonymizing personal data
Hashing, with sha2 and 256 bits, replaces a value with a digest, so equal values still match for joins and counts. Tokenization replaces a value with a random token, and keeps the mapping in a separate, protected table, so authorized users can reverse it. Suppression removes the column or sets it to null, and generalization keeps a coarser value, like an age range or a shortened postal code. Partial masking, with the mask function or a few stars, shows only part of a value, like the last four digits of a phone number. Hashing and tokenization are pseudonymization: with the mapping, or by hashing known values again, people can still be identified, so the data remains personal data. And removing personal data entirely is still safer than any obfuscation.
Finding personal data
Data classification, turned on for a catalog, runs an agent that scans its tables incrementally, detects columns with sensitive data, like emails or phone numbers, and tags them. Its results land in the system.data_classification.results table, and in a results view that shows who can see each class. Those classification tags can drive ABAC policies, so a new column that holds personally identifiable information, or PII, is protected without anyone touching it. Inside pipelines, ai_classify can label free text, and ai_mask can hide entities, like names and phone numbers, before the data reaches silver. So detect first, then protect with policies, and delete what is not needed.
Recap
Let's recap. Row filters choose the rows a user sees, and column masks choose the values. ABAC policies on a catalog or a schema apply them through governed tags, to every table, including new ones. Hashing keeps values joinable, tokenization keeps them reversible, and suppression and generalization remove detail. Hashing and tokenization are pseudonymization, so the data stays personal data. And data classification finds PII, and tags it for the policies.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
In the customers table, the EU support group must see only European customers, while the admins group sees every row. What should the data engineer attach to the table?
- A column mask on the region column
- A row filter function that checks the user’s group
- A copy of the table for each region
- A governed tag on the European rows
Show the answer
A row filter function that checks the user’s group
A row filter function checks the group of the user, and returns only the European rows to E U support. “A column mask on the region column” would hide the values of one column, and still show every row. “A copy of the table for each region” would copy the data, and the copies would drift apart. And “A governed tag on the European rows” is wrong, since tags label objects and columns, not individual rows.
Marketing must count distinct customers per city across the orders and the reviews tables, joined on the customer email, without ever seeing an email. What should the data engineer do?
- Hash the emails with sha2 in both tables
- Set the email column to NULL in both tables
- Keep only the email domain in both tables
- Mask all but the first letter of each email
Show the answer
Hash the emails with sha2 in both tables
The same email always gives the same hash value, so the tables still join, and distinct counts stay exact. “Set the email column to NULL in both tables” would remove the key, so nothing could be joined or counted. “Keep only the email domain in both tables” would merge every customer of the same email domain into one. And “Mask all but the first letter of each email” would still show part of each email, and many masked values would collide.
The team does not know which of the 400 tables in its main catalog hold emails or phone numbers, and new tables arrive every week. What should the data engineer turn on?
- ai_mask on every column of every table
- Governed tags applied by hand to each table
- A row filter on each table
- Data classification for the catalog
Show the answer
Data classification for the catalog
Data classification scans the catalog incrementally, and tags the sensitive columns, new tables included. “ai_mask on every column of every table” would run a model over every value, and still not tell where the personal data is. “Governed tags applied by hand to each table” would depend on people tagging four hundred tables by hand. And “A row filter on each table” would restrict rows, without finding the sensitive columns.