Propagate
Goal
Use propagate
to anonymize values of a table column, and then do the same anonymization on the same values in other table columns.
Useful for preserving foreign key constraints, and to ensure data integrity after anonymization is complete.
Use cases for propagate
Use propagate
when
- There is a foreign key constraint(s) to the column you are anonymizing
- when columns in different tables must be anonymized the same, even though there does not exist a foreign key constraint
- Without the foreign key constraint, you can ensure both tables are fully anonymized by
- First update the one table and
propagate
the update to the other table - Then update the other table with a
where
clause, so the updates are only performed on the subset of values that were not updated by the propagate
- First update the one table and
- Without the foreign key constraint, you can ensure both tables are fully anonymized by
propagate
is only usable in update
Work Tasks.
Ano Structure and Examples
- Structure
- Foreign Key Example
- No Foreign Key Example
- Two Foreign Keys Example
update <parent-table>
mask ID
format %d
unique
sequence -1 1
temporary-value 999999
propagate <child-table-1>.<foreign-key-column>, <child-table-2>.<foreign-key-column>
table Customer
column integer customerNo
primary-key customerNo
...
table Address
column integer ID size 10
column integer customer_customerNo
column ...
primary-key ID
...
foreign-key
Customer customerNo
Address customer_customerNo
...
task <task-name> {
// Update primary key and propagate to the foreign key
update Customer
mask customerNo
format %d
unique
sequence 1000 1
temporary-value 999999
propagate Address.customer_customerNo
}
Foreign Key Example
Note that Address
has a foreign key constraint to Customer
, so every Address.customer_customerNo
value must exist in Customer.customerNo
- We update
customerNo
in parent tableCustomer
and propagate the update to child tableAddress
.
table Customer
column integer customerNo
primary-key customerNo
...
table Address
column integer ID size 10
column integer customer_customerNo
column ...
primary-key ID
...
task <task-name> {
update Customer
mask customerNo
format %d
unique
sequence 1000 1
temporary-value 999999
propagate Address.customer_customerNo
update Address
where "Address.customer_customerNo NOT IN (SELECT DISTINCT Customer.customerNo FROM Customer)"
mask customer_customerNo
format %d
unique
sequence 100 1
temporary-value 999999
}
No Foreign Key Example
There is no foreign key constraint on Address
to Customer
. This means values of Address.customer_customerNo
may or may not exist in Customer.customerNo
.
- When they exist, then update the values through
propagate
- When they do not exist, then update the values separately, using a
where
clause. Thewhere
clause allows us to only update values inAddress
not hit by the propagate fromCustomer
table Customer
column integer customerNo
primary-key customerNo
...
table Address
column integer ID size 10
column integer customer_customerNo
column ...
table Booking
column integer id
column integer customer_customerNo
column ...
...
foreign-key
Customer customerNo
Booking customer_customerNo
foreign-key
Customer customerNo
Address customer_customerNo
task <task-name> {
update Customer
mask customerNo
format %d
unique
sequence 1000 1
temporary-value 999999
propagate Address.customer_customerNo, Booking.customer_customerNo
}
Two Foreign Keys Example
Both Booking
and Address
have foreign key constraints to Customer
- When updating
customerNo
inCustomer
, thenpropagate
customer_customerNo
to bothBooking
andAddress
.