Goal
A data subject asks to be erased, and legal gives you a customer ID and a deadline. A DELETE hides the rows from queries, but the bytes are still in ADLS:
- With deletion vectors on,
DELETEonly marks rows as removed. The Parquet file that holds them is unchanged. - Without deletion vectors,
DELETErewrites the file, but the old file stays on storage for time travel untilVACUUMremoves it. - Change data feed, clones, ADLS soft delete or versioning, and downstream copies can each keep their own copy.
This runbook takes one request from "rows hidden" to "bytes gone", and gives you the evidence to show for it.
| Where the data still lives after DELETE | Removed by |
|---|---|
| Files with deletion-vector marks | REORG TABLE ... APPLY (PURGE), then VACUUM |
| Old files kept for time travel | VACUUM once they are past the retention period |
_change_data files (CDF) | VACUUM, on the same retention rules |
| Deep clones, exports, extracts | Separate DELETE + PURGE + VACUUM on each |
| ADLS soft-deleted blobs or versions | Blob soft delete / versioning retention, or manual purge |
| Bronze raw files, Kafka/Event Hubs, source DB | Process for each source, outside Delta |
Caution
This is a destructive procedure. After
VACUUM, you cannot use time travel orRESTOREto go back to versions from before the erasure. Confirm the predicate on aSELECTfirst, and get sign-off if your change process requires it.
1. Find every table that holds the subject
Start from tags or column names, not from memory.
-- Columns tagged as personal data (governed or plain tags)
SELECT catalog_name, schema_name, table_name, column_name, tag_name, tag_value
FROM system.information_schema.column_tags
WHERE tag_name IN ('pii', 'class.personal'); -- use your own tag names
-- Fallback: likely key columns by name
SELECT table_catalog, table_schema, table_name, column_name
FROM system.information_schema.columns
WHERE lower(column_name) IN ('customer_id', 'email', 'person_id')
AND table_catalog NOT IN ('system', 'samples');
Lineage shows tables that were derived from those tables, such as gold aggregates, feature tables and exports:
SELECT DISTINCT target_table_full_name
FROM system.access.table_lineage
WHERE source_table_full_name = 'prod.silver.customers'
AND target_table_full_name IS NOT NULL
AND event_date >= current_date() - INTERVAL 90 DAYS;
Record the list in a request table so the run can be repeated and audited:
CREATE TABLE IF NOT EXISTS ops.privacy.erasure_requests (
request_id STRING, subject_key STRING, requested_at TIMESTAMP,
table_name STRING, status STRING, rows_deleted BIGINT, completed_at TIMESTAMP);
2. Delete the rows, bronze first
Work from bronze to gold. If you start downstream, the next incremental run can copy the subject back in from upstream.
-- Check first
SELECT COUNT(*) FROM prod.bronze.customers_raw WHERE customer_id = 'C-104233';
DELETE FROM prod.bronze.customers_raw WHERE customer_id = 'C-104233';
DELETE FROM prod.silver.customers WHERE customer_id = 'C-104233';
DELETE FROM prod.silver.orders WHERE customer_id = 'C-104233';
DELETE FROM prod.gold.customer_360 WHERE customer_id = 'C-104233';
DESCRIBE HISTORY shows how many rows each delete removed (operationMetrics.numDeletedRows). Record that in the request table.
Streaming readers of these tables
A DELETE on a streaming source table stops Delta stream readers with "Detected a data update". Readers that should ignore it need skipChangeCommits set to true. If a reader uses the change data feed, it receives the delete events, which is what you want for propagating the erasure. Check this before you run, not after on-call gets paged.
Lakeflow streaming tables and materialized views
Delete from the streaming table's target directly with DELETE, the same as for any table. Materialized views are recomputed from their sources, so remove the subject from the sources and then refresh.
3. Purge deletion vectors
Check whether the table uses deletion vectors:
SHOW TBLPROPERTIES prod.silver.customers ('delta.enableDeletionVectors');
If it does, rewrite the affected files so the rows are physically gone from the current version:
REORG TABLE prod.silver.customers APPLY (PURGE);
PURGE rewrites every file that has soft-deleted rows, not only the files for this subject. On a large table, run it in your maintenance window. You can limit it with a partition predicate if the table is partitioned:
REORG TABLE prod.silver.orders WHERE order_month >= '2025-01' APPLY (PURGE);
After the purge, the old files are no longer referenced, but they are still on storage. That is step 4.
4. VACUUM past the retention window
VACUUM removes unreferenced files older than the table's retention setting. The default is 7 days (delta.deletedFileRetentionDuration).
SHOW TBLPROPERTIES prod.silver.customers ('delta.deletedFileRetentionDuration');
-- Preview
VACUUM prod.silver.customers DRY RUN;
-- Run with the table's configured retention
VACUUM prod.silver.customers;
Plan the timeline with that window in mind. If retention is 7 days, the files rewritten today only become eligible for removal after 7 days. Your erasure SLA has to allow for that, or you need a shorter retention on PII tables, set ahead of time:
ALTER TABLE prod.silver.customers
SET TBLPROPERTIES ('delta.deletedFileRetentionDuration' = 'interval 3 days');
Warning
Running
VACUUM ... RETAIN 0 HOURSwith the retention check turned off (spark.databricks.delta.retentionDurationCheck.enabled = false) can break running queries and streaming jobs that still read older files. It also removes all time travel at once. Shorten the table property in advance instead of forcing it during an incident.
If predictive optimization runs VACUUM on your managed tables, it still follows the retention property. Check system.storage.predictive_optimization_operations_history to confirm the run happened instead of assuming it did.
Change data feed files under _change_data follow the same retention and are removed by the same VACUUM.
5. Clear the copies outside the table
Clones. A shallow clone points at the source table's files, so vacuuming the source can break it (FileNotFound). Recreate the shallow clone after the erasure. A deep clone has its own copy of the data, so repeat steps 2–4 on it.
-- Find clones in table history
SELECT * FROM (DESCRIBE HISTORY prod.silver.customers)
WHERE operation LIKE '%CLONE%';
ADLS soft delete and versioning. If blob soft delete or versioning is on for the storage account, files that VACUUM deletes are kept for that retention period too. Check the account:
az storage account blob-service-properties show \
--account-name stlakeprod --resource-group rg-data-prod \
--query "{softDelete:deleteRetentionPolicy, versioning:isVersioningEnabled}"
Include that retention period in what you tell legal, or keep PII tables in a container or account with a shorter soft-delete period.
Everything else. That covers raw landing files in volumes, Event Hubs or Kafka retention, extracts sent to other teams, Delta Sharing recipients that copied the data, and backups. Each needs its own owner and step in the request record.
6. Prove it
-- Current version: zero rows
SELECT COUNT(*) FROM prod.silver.customers WHERE customer_id = 'C-104233';
-- Old versions are gone: this should fail once VACUUM has removed the files
SELECT COUNT(*) FROM prod.silver.customers VERSION AS OF 120
WHERE customer_id = 'C-104233';
-- Evidence of the operations
SELECT version, timestamp, operation, operationMetrics
FROM (DESCRIBE HISTORY prod.silver.customers)
WHERE operation IN ('DELETE', 'REORG', 'VACUUM START', 'VACUUM END')
ORDER BY version DESC;
Update the request table to completed, with the history versions as evidence.
Prevent it next time
- Tag PII columns when tables are created, so step 1 is a query and not a hunt.
- Set a shorter
delta.deletedFileRetentionDurationon PII tables, and match ADLS soft-delete retention to the erasure SLA. - Run erasure as a scheduled job that reads a requests table and applies DELETE, PURGE and VACUUM in order. Repeated runs should be safe.
- Keep personal data out of free-text columns and log tables, where a key-based delete can't find it.
- For new pipelines, think about pseudonymising subject keys in silver and gold. Then erasure only has to happen in a small mapping table and in bronze.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get