Controller vs processor and what the acronyms mean, a treatment per column, why pseudonymised data is still personal data, who can actually call Decrypt, roles with one masked, row-filtered view, and tracing one erasure request through every copy.
⏱ 21 min readTopics chapter readerLevel · Production & Advanced
01 · Overview
Start here
⏱ 8 min · Topic 1 of 15
Pipelines carry data about real people: names, emails, orders and places. This data needs care. A leak, or a deletion request you cannot meet, hurts those people and the company.
Personal data is any data that points to a living person. A name is personal data. An email address is too.
We use the shop again. The five customers and the six orders are the same as before.
We add a made-up email column, such as asha@example.com. Every email, role, log and key in this chapter is made up.
What you already know
Data Contracts, Schema Evolution & Governance: owners, access grants and one masking policy.
Data Observability & Monitoring: lineage, which is the map of what reads what.
Delta Lake & the Lakehouse: time travel, and VACUUM, which deletes old files.
The Warehouse Platform: Storage, Compute & Loading: time travel in Snowflake.
Reliability, Failure & Recovery: backups and a second copy in another region.
We do not teach those again. We use them, and we add what they do not cover.
What you will learn
The words the law uses.
How to classify columns and hide them.
Why a plain hash of an email is weak.
Who holds the key, and where secrets live.
Roles, views and row rules.
Audit logs and lineage.
How to delete one person from everywhere.
The other rights people have, and retention.
Not legal advice
This chapter shows how privacy law shapes a pipeline. It is not legal advice. Check with your legal team before you act on a real request.
02 · The words
The words the law uses
⏱ 8 min · Topic 2 of 15
The main privacy law in Europe is the GDPR, the General Data Protection Regulation. It covers every company set up in the EU, for all the personal data it handles. Norway, Iceland and Liechtenstein apply it too.
A company outside the EU can be covered too. This happens when it offers goods or services to people in the EU, or tracks what they do there. The UK has its own similar law, the UK GDPR.
Six words decide who owes what. Look at the table, with the shop as the example:
Word
What it means
In the shop
Personal data
Data that points to a living person, alone or with other data.
Name, email and customer_id. An IP address too.
Data subject
The person the data is about. The rights belong to this person.
Asha is a data subject. So is each customer.
Controller
The organisation that decides why and how the data is used.
The shop. The shop owns the duty.
Processor
An organisation that handles data only on the controller’s orders.
The cloud warehouse, or the email service.
Data processing agreement (DPA)
The contract that says what a processor may do.
The shop signs one with each processor.
Special category data
Extra-sensitive data, such as health, religion or biometric data. It has stronger rules.
The shop holds none. A pharmacy would.
You build pipelines for the shop, so you work for the controller. Say Asha asks for her data to be deleted. The request goes to the shop.
The shop cannot say, "our cloud provider holds it." The shop must tell each processor what to do. A processor does not decide on its own.
Two more words are often mixed up:
PII means personally identifiable information. It is a US term, and it is often narrower than personal data.
PCI-DSS is a card-industry security standard, not a law. You agree to it in your contracts with card companies.
A dynamic IP address and a cookie id can be personal data. European courts have said this about IP addresses. They point to a person if someone can link them to one.
Watch out
Hiring a processor does not move your duty to them. The controller stays responsible for what its processors do.
03 · Protect the data
Protecting sensitive data
⏱ 8 min · Topic 3 of 15
You cannot protect data you have not found. The first step is classification: you label each column by how sensitive it is. Then you pick a treatment for each column.
Here is the customers table with the made-up email column:
Function names differ a little between warehouses. The name column is dropped, because the query does not select it.
A reader now sees a letter, not an email. Apply the treatment when the data arrives. If raw emails reach every table first, every copy and backup holds them.
Watch out
Check your logs too. A log line that holds an email is a leak, even when the tables are masked. Logs are rarely classified, and they are kept for months.
04 · Hashing
Hash, pseudonymise, anonymise
⏱ 12 min · Topic 4 of 15
Analysts often need to count or join by person. They do not need to read the email. A hash can help.
A hash function turns a value into a short fixed code. The same input always gives the same code. Look at the first 8 characters of a SHA-256 hash of each email:
The names SHA2 and SUBSTR differ by warehouse. The same email always gives the same code, so you can join on it.
But a plain hash is weak. Emails are easy to guess. An attacker hashes a list of known emails and compares the codes.
If the attacker hashes asha@example.com, the code starts with ea4e36a8. Now the attacker knows that row 1 is Asha. The hash did not hide a value that can be guessed.
The fix is a keyed hash, called HMAC. You mix a secret key into the hash. Without the key, an attacker cannot test guesses.
First make the emails lowercase and trim spaces. Otherwise one person gets two codes.
In this demo, get_secret returns the made-up bytes demo-key-1. A different key gives different codes. Never write a real key in code.
You may know a salt, a random value added to each row. Do not use a random salt per row here.
The same email would then give different codes, and you could not join. Use one secret key for all rows.
This is pseudonymisation: a stable code replaces the identifier. The GDPR says data is still personal data if extra information can link it back to a person. Here the extra information is the key, or a list of guesses.
So pseudonymised data still has erasure requests, access requests and breach rules.
Anonymous data is different. Nobody can identify a person by any means reasonably likely to be used. The law then does not apply.
That is hard to reach. Look at paid revenue by country. No names are in the result:
Asha is DE: 40.00 plus 25.00 is 65.00. Carla is US with 15.50, and Dev has no country and 80.00. Ben has no paid order.
Every row counts one customer. So each total belongs to one person, even with no name.
A common fix is a minimum group size: show a group only if it has at least a set number of people. Pick the number with your privacy team.
Interview question: how do you protect PII?
Classify the columns, pick a treatment for each, and apply it when the data arrives. Say that a hashed email is still personal data. Say that real anonymisation costs detail.
05 · Keys and secrets
Who actually holds the key?
⏱ 11 min · Topic 5 of 15
Encryption turns data into unreadable code. Only someone with the right key can read it again. A key is a secret value that locks and unlocks data.
Encryption in transit protects data on the network. It uses TLS, the standard for secure web connections.
Encryption at rest protects data stored on disks.
Which threat does each one stop? Look at the table:
Threat
Stopped by
Why
Someone listens on the network
Encryption in transit
Data on the wire is unreadable.
Someone steals a disk or a backup file
Encryption at rest
The files are unreadable without the key.
A leaked login that has read access
Not encryption
The platform decrypts for that login. Access control must stop it.
A person with too much access
Not encryption
Least privilege and audit logs must stop it.
Many real leaks look like the last two rows. So do not only ask, "is it encrypted?" Ask, "who can decrypt it?"
With a provider-managed key, the cloud provider holds the key. It decrypts for anyone allowed to read. With a customer-managed key, you own the key in a key management service (KMS).
A KMS is a locked service that holds master keys. You ask it to decrypt, and the master key never leaves it.
Reading then needs two permissions: one for the storage, and one for the key. You can remove either one.
Large data is usually locked in two steps, called envelope encryption. A data key locks the data. A master key in the KMS locks the data key.
One more idea links to deletion: crypto-shredding. You lock each person’s data with its own key.
To make the person’s data unreadable, you destroy the key. You must plan this before you store the data.
Keep secrets out of code
A secret is a password, a token or a key. If it is in code, it stays in git history, and everyone who reads the code sees it. Compare the two ways:
A password in code, and a password fetchedworked example
Both values are made up. A secrets manager can also change the password without a new deploy. If a secret reaches git, treat it as leaked and replace it.
Watch out
The pseudonymisation key from the last section is a secret too. If it leaks, an attacker can test any guessed email against your codes.
06 · Who can use what
Access control & governance
⏱ 9 min · Topic 6 of 15
Least privilege means each person and each program gets the least access that does the job.
A role is a named set of permissions. You give roles to people, not one grant at a time. This is role-based access control, or RBAC.
Data Contracts, Schema Evolution & Governance showed grants and one masking policy. Here you add a view. A view is a saved query that acts like a table.
You give a role access to the view and not to the table. One view can hide columns and rows. Say the shop has three made-up roles:
SUPPORT sees every customer and the full email.
ANALYST sees every customer, with the email masked.
ANALYST_IN sees only customers in country IN, with the email masked.
The third role needs a row rule. A small table says which countries a role may see. Here is the view, run as ANALYST_IN:
One view for all three rolesworked example
SQL
Input data
customers (email is made up)5 rows
customer_id
name
email
country
1
Asha
asha@example.com
DE
2
Ben
ben@example.com
GB
3
Carla
carla@example.com
US
4
Dev
dev@example.com
NULL
5
Omar
omar@example.com
IN
role_countries (made up)1 row
role_name
country
ANALYST_IN
IN
CREATESECUREVIEWcustomers_safeASSELECTc.customer_id,CASEWHENCURRENT_ROLE()='SUPPORT'THENc.emailELSELEFT(c.email,1)||'***'ENDASemail,c.countryFROMcustomerscWHERECURRENT_ROLE()IN('SUPPORT','ANALYST')ORc.countryIN(SELECTrc.countryFROMrole_countriesrcWHERErc.role_name=CURRENT_ROLE());SELECT*FROMcustomers_safe;-- run as ANALYST_IN
What ANALYST_IN sees
customer_id
email
country
5
o***
IN
This is Snowflake syntax. In Snowflake, use a secure view, so hidden rows cannot leak. Only Omar has country IN, because Asha moved to DE, and Dev’s NULL country matches no rule.
Now run the same view as each role. Look at the rows they see:
Role
Rows seen
Email column
SUPPORT
5 rows: customers 1 to 5
Full, such as asha@example.com
ANALYST
5 rows: customers 1 to 5
Masked: a***, b***, c***, d***, o***
ANALYST_IN
1 row: customer 5
Masked: o***
You keep one table and one view. The other way is a masked copy for each group. Copies drift apart, and an erasure request must then be done in every copy.
Warehouses also have built-in masking and row policies. The idea is the same.
A service account is a login that a program uses, not a person. Pipelines often run as one. Give it only what it needs, and review it like a person.
Watch out
If ANALYST can also read the customers table, it can skip the view. Grant the roles on the view only.
07 · Who did read it?
Audit logs and lineage
⏱ 5 min · Topic 7 of 15
A grant says who can read data. An audit log says who did read it. These are two different questions.
Here is a made-up access log for 2026-01-22. Find who read the raw customers table:
The loader reads the raw table every night, which is normal. Mira has the role ANALYST, who should read customers_safe. Fix her grant, then check what she did with the data.
Lineage is the map of what reads what, from Data Observability & Monitoring. For privacy it answers one question: where did Asha’s email go? You need that answer for deletion requests and for breach reports.
A data catalog is a searchable list of datasets. Each dataset has an owner and a label such as "holds personal data". Without a catalog, nobody can say which tables hold personal data.
08 · The hard part
Deleting one person from everywhere
⏱ 7 min · Topic 8 of 15
The right to erasure is Article 17 of the GDPR. A person can ask you to delete their personal data.
You must answer within one month. For complex or many requests you may extend by two more months, but you must tell the person within the first month.
Say Asha, customer 1, asks on 2026-01-22. Her data is in more places than the customers table. You can only delete what you can find, so lineage comes first.
Look at the places and the action for each:
Place
What it holds
Action
App database: customers
Row 1: her name and email
Remove the name and email.
App database: orders
Orders 101 and 102
Keep them. Many countries require order records. Ask legal.
Raw files in the lake
The customers file with her row
Rewrite the file without her.
Delta table and warehouse copy
Her row, and old versions of it
Delete the row. Then wait for old versions to expire.
Backups
A copy from before the request
You cannot edit it. Let it expire.
Caches and exports
A dashboard extract with her email
Refresh or delete it.
Email service (a processor)
Her email address
Send a delete instruction. Keep the reply.
daily_revenue
The 2026-01-03 total of 40.00
That total is one order, hers. Ask legal.
Start with the database. Remove her name and email, and keep the row, so orders still join:
Row 1 stays, so orders 101 and 102 still point to a customer. They no longer point to a name. Whether the rest still counts as personal data is a legal question.
The lake, the warehouse and the backups need their own steps. The next section shows how old versions and backups keep her data alive.
Watch out
Article 17(3) lets you refuse part of a request, for example to keep records that the law requires. You must still reply and say what you kept and why. Never skip a part in silence.
09 · Old copies
Old versions and backups
⏱ 7 min · Topic 9 of 15
A delete does not remove the old versions. Time travel keeps them on purpose, and backups keep old copies too.
Delta Lake & the Lakehouse showed deletion vectors. With them on, DELETE only marks her row, and the row stays in the file. REORG TABLE with APPLY (PURGE) rewrites the file without her, before the VACUUM.
Look at how long each one keeps Asha:
Store
How long her old data stays
What you do
Delta table
Until VACUUM removes the old files. The default retention is 7 days.
Delete the row. With deletion vectors on, run REORG TABLE with APPLY (PURGE). Then VACUUM after 7 days.
Snowflake permanent table
Time travel: 1 day by default, up to 90 days on Enterprise. Then 7 days of Fail-safe, a recovery copy only Snowflake can reach.
Delete the row. Then wait.
Backups
Until the backup expires.
Let it expire. The next section shows what to do after a restore.
Delta Lake & the Lakehouse taught time travel and VACUUM. Here the delete and the VACUUM are 7 days apart:
Delete, then VACUUMworked example
SQL
Input data
What an old-version query shows (customer 1)3 rows
Date
Step
Old version still shows Asha?
2026-01-22
DELETE
Yes. The old files are still there.
2026-01-28
No VACUUM yet
Yes. Only 6 days have passed.
2026-01-29
VACUUM
No. The old files are older than 7 days.
-- 2026-01-22: remove Asha from the lake copyDELETEFROMcustomers_lakeWHEREcustomer_id=1;REORGTABLEcustomers_lakeAPPLY(PURGE);-- only if deletion vectors are on-- 2026-01-29 or later: remove the old filesVACUUMcustomers_lake;
The table name customers_lake is made up. You can shorten the retention time, but running queries and time travel may break.
Snowflake can keep her data for 8 days or more after the delete. With a longer time travel setting, it can outlast the one month you have to reply.
Tell the person that old copies expire on a set date. Ask your legal team how to word it.
Crypto-shredding, from the encryption section, makes her data unreadable in a file you cannot edit. It needs one key per person, from the first day. Whether that counts as erasure is a question for your legal team.
10 · Stay deleted
Do not bring her back
⏱ 5 min · Topic 10 of 15
Deleting her today does not stop her coming back tomorrow. A backfill can reload an old file with her row. A restored backup can do the same.
The fix is a suppression list: a small table of people who asked to be erased. Every load checks it first. Keep as little as you can: the key and the date, not the name.
Say the 2026-01-08 file is loaded again. It has five rows. The suppression list is made up:
The LEFT JOIN keeps every file row. The IS NULL test keeps rows with no match on the list. Row 1 is dropped.
Watch out
After you restore a backup, run every deletion since the backup date again. The backup still holds the people you erased.
11 · The rights
What the law actually requires
⏱ 5 min · Topic 11 of 15
Erasure is one right of several. Each right asks your pipeline for a capability. Look at the table:
Right
What a person can ask
What your pipeline needs
Access (Article 15)
A copy of the data you hold on them.
A catalog and lineage, to find it.
Rectification (Article 16)
Fix wrong data.
The fix must reach every copy.
Erasure (Article 17)
Delete their data.
Lineage, deletion steps and a suppression list.
Restriction and objection (Articles 18 and 21)
Restriction: keep the data but stop using it. Objection: stop one use, such as marketing.
A flag that every pipeline respects.
Portability (Article 20)
The data they gave you, in a file a machine can read.
An export job.
All of these have the same one-month deadline as erasure. Each one is a lineage or catalog problem. If you cannot find a person’s data, you cannot answer any of them.
Breach notification is different. A breach is when personal data leaks, or is lost or changed by mistake. Article 33 says you usually must tell the regulator within 72 hours of finding out.
The audit log, the catalog and lineage help you say what leaked.
Some rules depend on the country and on your contract. Check with your legal team.
12 · Keep less
Retention and residency
⏱ 6 min · Topic 12 of 15
Article 5 says to keep personal data only as long as you need it. A retention policy sets a time limit for each dataset. The cheapest rule is to not collect what you do not need.
Say the shop keeps login events for 14 days. The job runs on 2026-01-22, so the cutoff is 2026-01-08.
The table is made up. The IP addresses come from a range reserved for examples:
Only event 250, from 2026-01-03, is older than the cutoff. An IP address is personal data, so this delete also lowers the risk of a leak.
This delete leaves old versions in time travel, as the last sections showed. Include them in the plan.
Data residency means the data must stay in a region. It covers backups and replica copies too.
The second region copy from Reliability, Failure & Recovery can break a residency rule. Check each region against your rules.
13 · Recap
Recap and interview answer
⏱ 5 min · Topic 13 of 15
Six ideas to keep:
Classify each column. Then drop, mask, pseudonymise or generalise it.
A plain hash of an email can be guessed. A keyed hash is still personal data.
Encryption at rest stops disk theft. Ask who can decrypt, and keep secrets out of code.
Give roles access to a view. Keep one table, not one copy per group.
For erasure, find every copy. Delete, keep what the law requires, wait out old versions, and suppress.
Set a retention time, and do not collect what you do not need.
Check yourself
Why does the 80.00 total for Dev point to one person?
Why is a hashed email still personal data?
On 2026-01-22 you delete a row from a Delta table. When can VACUUM remove the old files?
Why must you run deletions again after restoring a backup?
Interview question: a deletion request in a data lake
Find every copy with lineage. Delete or update where you can, and keep records the law requires. Then rewrite raw files, VACUUM, let backups expire, instruct processors, suppress the person, and reply.
14 · Practice
Practice Lab
⏱ 3 min · Topic 14 of 15
Build each scenario on the pipeline canvas with the chapter closed. The review tells you which requirement your design missed. The last one, erasure, is the hardest.
For every new store, ask: can a person be identified here, and can I remove them?
After each review, write one sentence about the requirement you missed.
15 · Next Chapter
Next Chapter
You now know foundations, building, streaming and the production concerns. The last chapter puts them together.
⏱ 3 min · Topic 15 of 15
Next chapter
Applied Pipeline Design: How To Architect Any Pipeline
You now know foundations, building, streaming and the production concerns. The last chapter puts them together.
It gives you one method to design any pipeline: from requirements to architecture, with the reasons for each choice. It also shows how to explain a design in an interview.