Customize masking
Published 03 November 2024
We're going to customize classification to do the following:
A. Add a custom masking
B. Supply a custom dataset
C. Set custom date/time formats
These customizations will be done using the options file passed to the masking.
This can also be done by editing the masking.json
file, but any changes will get overwritten next time mapping is run.
A. Add a custom masking
- {
- "tables": [
- {
- "schema": "dbo",
- "name": "Territories",
- "columns": [
- {
- "name": "TerritoryDescription",
- "dataset": "Cities"
- }
- ]
- }
- ]
- }
This configures the TerritoryDescription
column of the dbo.Territories
table to be masked as "Cities".
B. Supply a custom dataset
- {
- "datasets": [
- {
- "name": "Websites",
- "type": "List",
- "values": [
- "https://www.example.com",
- "https://www.test.com",
- "https://www.google.com"
- ]
- }
- ]
- }
This supplies a custom dataset, "Websites", that will be used in masking.
C. Set custom date/time formats
- {
- "settings": {
- "dateTimeFormats": [
- "YYYY-MM-dd",
- "yyyy-mm-dd HH:mm:ss"
- ]
- }
- }
This supplies custom date/time formats to be used when masking date/time values.
masking-options.json
Putting the configurations for A-C above together into one options file produces the following:
- {
- "tables": [
- {
- "schema": "dbo",
- "name": "Territories",
- "columns": [
- {
- "name": "TerritoryDescription",
- "dataset": "Cities"
- }
- ]
- }
- ],
- "datasets": [
- {
- "name": "Websites",
- "type": "List",
- "values": [
- "https://www.example.com",
- "https://www.test.com",
- "https://www.google.com"
- ]
- }
- ],
- "settings": {
- "dateTimeFormats": [
- "YYYY-MM-dd",
- "yyyy-mm-dd HH:mm:ss"
- ]
- }
- }
This should be saved into a file called masking-options.json
, and will be passed into the masking step when it is run.