
This article describes how to use and configure anonymization feature of SAP Commerce DB Sync tool. Support for data anonymization was introduced in release v1.2.7 - it allows to alter the data on the fly during migration process based on provided configuration.
DB Sync extensions has to be included in Customer's repository and properly configured for data migration. For more informations please refer to:
Configuration is quite simple and consists of just two steps. Firstly, data anonymization has to be enabled, and then config file has to be adjusted to specify what data and how it will be altered during migration process.
By default this is disabled, to enable set the following property:
migration.anonymizer.enabled=true
Configuration file is provided in SAP Commerce DB Sync tool, it can be found in commercedbsync extension under resources/anonymizer/config.yml. Out of the box it includes sample configuration for following tables:
This should be a good starting point. However, it is important that you review and adjust this file to cover all necessary fields to ensure that data will be completely anonymized!
In this example we will use below OOTB configuration for tabes users and addresses:
tables:
- name: users
columns:
- name: p_name
operation: REPLACE
text: "{GUID}-{RANDOM(number,5)}"
- name: p_description
operation: REPLACE
text: "new description"
- name: p_uid
operation: REPLACE
text: "{GUID}-{RANDOM(number,5)}"
excludeRow: ["anonymous", "admin"]
- name: p_originaluid
operation: REPLACE
text: "{GUID}-{RANDOM(number,5)}@test.com"
- name: p_email
operation: REPLACE
text: "{GUID}-{RANDOM(number,5)}@test.com"
- name: addresses
columns:
- name: p_cellphone
operation: REPLACE
text: "{RANDOM(number,10)}"
- name: p_phone1
operation: REPLACE
text: "{RANDOM(number,10)}"
- name: p_phone2
operation: REPLACE
text: "{RANDOM(number,10)}"
- name: p_email
operation: REPLACE
text: "{GUID}-{RANDOM(string,5)}.{RANDOM(number,2)}@test.com"
exclude: ["anette.customer@hybris.com", "keenreviewer24@hybris.com"]
- name: p_fax
operation: REPLACE
text: "{RANDOM(number,10)}"
- name: p_firstname
operation: REPLACE
text: "name_{RANDOM(number,5)}"
- name: p_lastname
operation: REPLACE
text: "lastname_{RANDOM(number,5)}"
- name: p_middlename
operation: REPLACE
text: "middlename_{RANDOM(number,5)}"
- name: p_middlename2
operation: REPLACE
text: "middlename2_{RANDOM(number,5)}"
- name: p_postalcode
operation: REPLACE
text: "{RANDOM(number,5)}"
- name: p_streetname
operation: REPLACE
text: "{RANDOM(street)}"
- name: p_streetnumber
operation: REPLACE
text: "{RANDOM(number,3)}"
- name: p_town
operation: REPLACE
text: "{RANDOM(city)}"
By inspecting code above, you can see that it is possible to define how to alter data for specific column and also exclude certain values, or entire rows from the anonymization process.
In this example, in users table we don't want to alter any columns related to admin user. That way we still have a valid user that we can log in to after the data is migrated and anonymized.
Please also notice that for addresses random city and street is used. Those fields will be populated on randomly picked predefined data from commercedbsync/resources/anonymizer/address.json file.
For more information regarding anonymization configuration please refer to Anonymizer Documentation.
Once anonymizer is enabled and configuration is in place there are no more extra steps - you can just start the migration from HAC and wait for the process to finish.
After successful migration it is necessary to validate that data has been properly anonymized. It can be done by running some queries or checking in the Backoffice.
Table: users
PK | p_uid | p_name | p_description |
8796093054980 | admin | Administrator | administrator description |
8796096364548 | canonlover@hybris.com | Canon Lover | Test description 1 |
8796096724996 | vipgiold@hybris.com | Customer VIP Gold | Test description 2 |
8796096790532 | aaron.customer@hybris.com | Aaron Customer | Test description 3 |
8796096856068 | andrew.customer@hybris.com | Andrew Customer | Test description 4 |
Table: addresses
PK | p_phone1 | p_town | p_streetname |
8796093054999 | +81 4535 1332 | Osaka | Shinsaibashi |
8796093087767 | +81 7684 8185 | Tokio | Shinkawa Chuo |
8796093120535 | +81 1114 9907 | Yokohama | Sakuragicho |
8796093153303 | +81 4220 68 | Yokohama | Sumiyoshi-Cho |
8796093186071 | +81 7093 958 | Tokio | Higashi Shimbashi |
Table: users
PK | p_uid | p_name | p_description |
8796093054980 | admin | Administrator | administrator description |
8796096364548 | 30d04a66-0cea-446c-875a-2b8dbc9e8564-43703 | 7c0f2cb1-76fc-4ee6-8bc8-629d7b75f9c9-31824 | new description |
8796096724996 | 749b7b2e-b987-49cc-839f-3d53ebd0dcfd-57335 | a3c2ca1e-c5bf-4678-aec8-bd69b3037277-18655 | new description |
8796096790532 | 59fc93bf-3470-4855-9dac-0abaf3b883e0-69104 | a030c308-7fa3-4b77-a1f3-1ce6dc12fa41-70960 | new description |
8796096856068 | 72e282f2-8ea4-437e-be0a-9b32fb6dec0f-18872 | 2a737580-6d47-4876-a136-86e83b5dded9-65694 | new description |
Table: addresses
PK | p_phone1 | p_town | p_streetname |
8796093054999 | 4654719409 | Andorra la Vella | Viali di Circonvallazione |
8796093087767 | 6487859143 | Palermo | Clerkenwell Road |
8796093120535 | 5821083594 | Amsterdam | Friedrichstrabe |
8796093153303 | 5577704800 | Leipzig | Ponte Vecchio |
8796093186071 | 1970063394 | Warsaw | Corso Buenos Aires |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |