#208 Data governance 5.8 min
Right to Erasure Across a Pipeline: Delete, Scan, Restore
I erased a person, a scan found her still in an export, and a restore brought her back.
Erase a different person
Copy the code folder first. In run.py change ana@example.com to ben@example.com and run python run.py. You should see before: database 2, newsletter.csv 1, then a first pass with only newsletter.csv 1 left, a clean second pass, and the database back to 2 after the restore.
A hint
Ben has a customer row and a ticket with his email, and a line in the newsletter.
Hide Ana's email in someone else's order
In stores.py change the note of order 11 from 'standard' to 'gift from ana@example.com'. Run python run.py. You should see the scan still find one database line after the second pass, because order 11 belongs to Ben so it is not deleted. After the re-apply it is still there too. Undo this change afterwards, so the next exercises give the numbers they state.
A hint
This is why the video scans the whole database as text.
Put the plain email in the log
In erase.py change log.add(digest(email)) to log.add(email). Predict what the last two lines of python run.py will show, then run it. You should see the last line say email in log: True, and after re-apply the database still holds 3 lines, so the erasure did not survive the restore. The last line still says log holds 1 hash, but it now holds the email, so the word hash is wrong.
A hint
reapply looks for the hash of each email in the log.
Add a store the scan must watch
In stores.py add a second export to the exports dictionary: "invoices.txt": "ana@example.com paid\nben@example.com paid\n". Predict the before line and the first pass line from python run.py, then run it. You should see invoices.txt 1 in both lines, and clean after the second pass.
A hint
The first pass is the one that skips the exports.
These tasks are for you to try on your own machine. Nothing is checked or saved.
What this does not show
Made-up shop with three stores; the scan only finds the email as text, a hash of an email is not anonymous, and this is not legal advice.
Up next in Data governance
More in Data governance
Related videos
- #269 Schema Design for RAG: Chunks, Versions, Sources in SQLite Data modelling
- #204 Tag PII Columns in Python, Including a False Positive Data governance
- #209 UK GDPR Data Map as Code: A Practical Checklist Data governance
- #100 Fake but Realistic Test Data in Python With Faker AI security and governance
