Data Engineer Professional · Domain 6: Ensuring Data Security and Compliance · 8% of the exam
Task 6.3: Apply anonymization and pseudonymization methods — such as hashing, tokenization, suppression, and generalization — to confidential data (e.g., using column masks and related Unity Catalog features).
Salted and keyed hashing, token tables, encryption functions with secrets, masking, generalizing values, and which methods can be reversed.
Study it
Hashing, tokenization, suppression and generalization
Try each one before opening the answer. Every option is explained, with the Databricks documentation page that proves it.
Question 1 · choose 1
Several silver tables must replace email with a pseudonymous key so that analysts can still join them, on Databricks Runtime 19. Analysts must not be able to recover emails, including by hashing a list of known emails and comparing. The key must be the same for an email in every table and load. Which expression meets these requirements?
Asha2(email, 256), applied identically in every table and every load
Bmask(email), the built-in masking function
Cuuid(), generated for each row at load time
Dhex(hmac(secret key, email)) with a key from a secret scope
Show the answer and why
Asha2(email, 256), applied identically in every table and every load
Incorrect
An unkeyed hash is consistent, but anyone can hash known emails and match the results.
Bmask(email), the built-in masking function
Incorrect
Masking replaces letters and digits with placeholders, so different emails collide and the value no longer works as a join key.
Cuuid(), generated for each row at load time
Incorrect
A random value per load changes between loads and tables, so joins break.
Dhex(hmac(secret key, email)) with a key from a secret scope
Correct
A keyed hash gives the same value for the same email, and without the secret key nobody can recompute it from candidate emails.
hmac computes a keyed hash with a secret key, so values are consistent but cannot be reproduced without the key. sha2 alone is unkeyed, mask replaces characters, and random values are not stable across loads.
Analysts may see a customer's age band but not the exact birth date. Only the medical team may see full dates. Which anonymization method fits the analysts' view?
AGeneralization, with a column mask that returns only the year
BSuppression, with a column mask that returns NULL for analysts
CTokenization, replacing each date with a random token per row
DEncryption of the date with aes_encrypt for the analysts
Show the answer and why
AGeneralization, with a column mask that returns only the year
Correct
Generalization replaces a value with a coarser one, and a column mask can return it based on group membership.
BSuppression, with a column mask that returns NULL for analysts
Incorrect
Suppression hides the value entirely, losing the age band.
CTokenization, replacing each date with a random token per row
Incorrect
A token hides the value but keeps no age information.
DEncryption of the date with aes_encrypt for the analysts
Incorrect
Ciphertext keeps no usable age information for analysts.
Column masks are SQL UDFs that return a value per row based on the querying user. Returning a coarser value, such as the year, generalizes the data for some groups while others see the full value.
The ssn column must be hidden completely from everyone outside the payroll group, with no partial digits shown. Which mask body fits?
ACASE WHEN is_account_group_member('payroll') THEN ssn ELSE mask(ssn) END
Bsha2(ssn, 256) for everyone
CCASE WHEN current_user() = 'payroll' THEN ssn ELSE NULL END
DCASE WHEN is_account_group_member('payroll') THEN ssn ELSE NULL END
Show the answer and why
ACASE WHEN is_account_group_member('payroll') THEN ssn ELSE mask(ssn) END
Incorrect
A partly masked string still exposes the shape of the value.
Bsha2(ssn, 256) for everyone
Incorrect
Payroll would lose the real value, and hashes can be matched.
CCASE WHEN current_user() = 'payroll' THEN ssn ELSE NULL END
Incorrect
current_user() returns a user, not a group name.
DCASE WHEN is_account_group_member('payroll') THEN ssn ELSE NULL END
Correct
Returning NULL for others suppresses the value entirely.
A column mask function receives the column value and returns what each user sees. Checking group membership with is_account_group_member and returning NULL otherwise suppresses the value.
What does mask('Ab-12') return with the default arguments?
A'XX-XX'
B'Xx-nn'
C'*****'
DNULL
Show the answer and why
A'XX-XX'
Incorrect
Each class has its own default replacement character.
B'Xx-nn'
Correct
Upper case becomes X, lower case x and digits n; other characters stay as they are by default.
C'*****'
Incorrect
The default does not use asterisks or mask the separator.
DNULL
Incorrect
mask returns a masked string, not NULL.
mask(str) replaces upper-case letters with X, lower-case letters with x and digits with n. Other characters are left unmasked unless otherChar is given.
Account numbers must be stored so that most users see an unreadable value, but the fraud team must be able to recover the original numbers when needed. Which approach allows this?
Asha2(account_number, 512), with the hash stored instead of the number
Bmask(account_number), with the masked value stored instead
Caes_encrypt with a secret-scope key; the fraud team uses aes_decrypt
DA column mask that returns NULL on every read
Show the answer and why
Asha2(account_number, 512), with the hash stored instead of the number
Incorrect
A hash cannot be reversed to the original number.
Bmask(account_number), with the masked value stored instead
Incorrect
Masking discards the original digits.
Caes_encrypt with a secret-scope key; the fraud team uses aes_decrypt
Correct
AES encryption is reversible for whoever holds the key.
DA column mask that returns NULL on every read
Incorrect
NULL keeps no recoverable value.
Encryption with aes_encrypt is reversible with aes_decrypt and the same key, which should be kept in a secret scope. Hashing and masking are one way.