Transformations
Transformations
Parameters of a transformation. All parameters have a type key with the type name of the transformation, and other parameters that are transformation-specific.
Depending on type property value, can be one of the following:
Key |
Link |
Modes |
Data types |
Multiple columns |
|
GENERATION, MASKING |
Yes |
||
|
GENERATION, MASKING |
Yes |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
Yes |
||
|
GENERATION, MASKING |
Yes |
||
|
MASKING |
No |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
No |
||
|
MASKING |
No |
||
|
GENERATION, MASKING |
Yes |
||
|
MASKING |
Yes |
||
|
GENERATION, MASKING |
Yes |
||
|
GENERATION, MASKING |
Yes |
||
|
GENERATION, MASKING |
Yes |
||
|
MASKING |
No |
||
|
MASKING |
No |
||
|
MASKING |
No |
||
|
MASKING |
No |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
Yes |
||
|
GENERATION, MASKING |
No |
||
|
MASKING |
No |
||
|
MASKING |
No |
||
|
MASKING |
No |
||
|
MASKING |
No |
||
|
GENERATION, MASKING |
Yes |
||
|
GENERATION, MASKING |
Yes |
||
|
GENERATION, MASKING |
No |
||
|
GENERATION, MASKING |
Yes |
Categorical generator
Properties
-
type = categorical_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: Yes
Conditional generator
Uses one of two transformations/generators depending on the value of a column. If the value of the conditional column equals conditional_value, then the if_true transformation is used, otherwise the if_false transformation is used.
Conditioning on the same table:
Omit conditional_table (or set it to the table being transformed) to condition on the row currently being generated; no foreign key is required. Below, tracking_reference is only set for orders whose status is DONE:
transformations:
- columns: [ "status" ]
params:
type: categorical_generator
categories:
value_source: PROVIDED
values:
"PENDING": 51
"DONE": 49
- columns: [ "tracking_reference" ]
params:
type: conditional_generator
# No conditional_table, so the condition is evaluated against the
# "status" column of the same row.
conditional_column: "status"
conditional_value: "DONE"
if_true:
type: formatted_string_generator
pattern: "TRK-[0-9]{8}"
if_false:
type: null_generator
Conditioning on its own column:
When masking, conditional_column can be one of the transformed columns; the condition then reads that column’s original value. Below, the UNASSIGNED placeholder in tracking_reference is kept and every other value is replaced. Generation has no original value, so this is rejected in GENERATION mode:
transformations:
- columns: [ "tracking_reference" ]
params:
type: conditional_generator
conditional_column: "tracking_reference"
conditional_value: "UNASSIGNED"
if_true:
type: passthrough
if_false:
type: formatted_string_generator
pattern: "TRK-[0-9]{8}"
Conditioning on a parent table:
Set conditional_table to a parent table to condition on the referenced parent row. Below, order_completed is true for orders whose public.delivery row has status DONE:
transformations:
- columns: [ "order_completed" ]
params:
type: conditional_generator
conditional_table: "public.delivery"
conditional_column: "status"
conditional_value: "DONE"
if_true:
type: constant_boolean
value: true
if_false:
type: constant_boolean
value: false
When conditioning on a parent table, the table being transformed must have a foreign key referencing conditional_table. In the above example, public.orders must have a foreign key to public.delivery.
| If the foreign key required by the generator is not present in your database schema, you can define a virtual foreign key as shown here |
Properties
-
type = conditional_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: Yes
Continuous generator
Properties
-
type = continuous_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: NUMERIC
Supports multiple columns: No
Quantile generator
Properties
-
type = quantile_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: NUMERIC
Supports multiple columns: No
Foreign key generator
Fills columns with the parent table’s primary key values of a random row.
| Normally this generator is being created implicitly wherever data generation for tables related with foreign keys is needed, so it should not be explicitly set up by the user. |
Properties
-
type = foreign_key_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: Yes
Unique generator
This generator is intended for the case where primary key values are part of the foreign key.
| Normally this generator is being created implicitly wherever data generation for tables related with foreign keys is needed, so it should not be explicitly set up by the user. |
Properties
-
type = unique_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: Yes
Format preserving hashing
Properties
-
type = format_preserving_hashing
Compatible modes: MASKING
Compatible column data types: TEXT
Supports multiple columns: No
Formatted string generator
Properties
-
type = formatted_string_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: No
Integers sequence generator
Properties
-
type = int_sequence_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: NUMERIC
Supports multiple columns: No
String sequence generator
Properties
-
type = string_sequence_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: TEXT
Supports multiple columns: No
Noising transformation
Properties
-
type = noising
Compatible modes: MASKING
Compatible column data types: NUMERIC
Supports multiple columns: No
Null generator
The output column is filled with null values
Example:
transformations:
- columns: ["empty_column"]
params:
type: null_generator
Properties
-
type = null_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: Yes
Passthrough transformation
The output data is equal to the input, no transformation is applied.
Example:
transformations:
- columns: ["customer_number", "plate"]
params:
type: passthrough
Properties
-
type = passthrough
Compatible modes: MASKING
Compatible column data types: ANY
Supports multiple columns: Yes
Person generator
Properties
-
type = person_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: TEXT
Supports multiple columns: Yes
Address generator
Properties
-
type = address_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: TEXT
Supports multiple columns: Yes
Finance generator
Properties
-
type = finance_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: TEXT
Supports multiple columns: Yes
Redaction masker
Properties
-
type = redaction
Compatible modes: MASKING
Compatible column data types: TEXT
Supports multiple columns: No
Unique hashing
Properties
-
type = unique_hashing
Compatible modes: MASKING
Compatible column data types: NUMERIC
Supports multiple columns: No
Date unique hashing
Properties
-
type = date_time_unique_hashing
Compatible modes: MASKING
Compatible column data types: DATE
Supports multiple columns: No
Enum unique hashing
Properties
-
type = enum_unique_hashing
Compatible modes: MASKING
Compatible column data types: TEXT
Supports multiple columns: No
Date generator
Properties
-
type = date_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: DATE
Supports multiple columns: No
UUID generator
The output column is filled with UUIDs.
Example:
transformations:
- columns: ["unique_id"]
params:
type: uuid_generator
Properties
-
type = uuid_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: No
Constant numeric generator
Properties
-
type = constant_numeric
Compatible modes: GENERATION, MASKING
Compatible column data types: NUMERIC
Supports multiple columns: No
Constant string generator
Properties
-
type = constant_string
Compatible modes: GENERATION, MASKING
Compatible column data types: TEXT
Supports multiple columns: No
Default value generator
Properties
-
type = default_value
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: No
Constant date generator
Properties
-
type = constant_date
Compatible modes: GENERATION, MASKING
Compatible column data types: DATE
Supports multiple columns: No
Constant boolean generator
Properties
-
type = constant_boolean
Compatible modes: GENERATION, MASKING
Compatible column data types: BOOLEAN
Supports multiple columns: No
Loop generator
Generates a sequence of elements in a loop that can be repeated. Data can be obtained from various sources or generated based on existing data. The following example demonstrates how to accomplish this:
transformations:
- columns:
- transaction_type
params:
type: "loop_generator"
repeatable: true
source:
value_source: "PROVIDED"
values:
- "sent"
- "skipping_value"
- "received"
- null
This transformation can be applied to several columns at once. This illustrates how the generator can handle multiple columns with provided tuples of values that always appear together:
transformations:
- columns:
- productcode
- productname
params:
type: "loop_generator"
repeatable: true
source:
value_source: "MULTIPLE_PROVIDED"
values:
- productcode: "P1"
productname: "Product 1"
- productcode: "P2"
productname: "Product 2"
- productcode: "P3"
productname: "Product 3"
- productcode: null
productname: null
You can also specify a CSV file as the source of elements. The following example illustrates the complete configuration example:
transformations:
- columns:
- productcode
- productname
params:
type: "loop_generator"
repeatable: true
source:
value_source: "CSV_FILE"
path: src/e2e/resources/data_with_header_multi.csv
null_values: null
format:
encoding: "UTF-8"
delimiter: ","
trim: true
columns:
column_accessor_type: NAME
names: ["code", "name"]
Properties
-
type = loop_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: Yes
Constant XML generator
Properties
-
type = constant_xml
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: No
JSON pointer transformer
Transforms JSON value nodes indicated by JSON pointers. The rest of the values are kept as is.
Example:
transformations:
- columns: ["productspec"]
params:
type: "json_pointer_transformer"
specifications:
- pointers: [ "/sku" ]
transformation:
type: "format_preserving_hashing"
- pointers: [ "/tags/0" ]
transformation:
type: "format_preserving_hashing"
ignore_errors: true
Properties
-
type = json_pointer_transformer
Compatible modes: MASKING
Compatible column data types: ANY
Supports multiple columns: No
Xml XPath transformer
Transforms XML value nodes indicated by XML XPath. The rest of the values are kept as is.
Example:
transformations:
- columns: ["productspec"]
params:
type: "xpath_transformer"
specifications:
- queries: [ "/sku" ]
transformation:
type: "format_preserving_hashing"
Properties
-
type = xpath_transformer
Compatible modes: MASKING
Compatible column data types: ANY
Supports multiple columns: No
JSON multi-value transformer
Masks a T24 multi-value column stored in the JSON format. The column holds either a single bare value or a JSON array (a nested array carries sub-values); each non-empty string leaf is masked independently with the inner transformation and the structure is rebuilt. Nulls and empty leaves are preserved. Use this for multi-value PII (names, addresses, phones, emails) on the json format.
Example:
transformations:
- columns: ["NAME.1"]
params:
type: "json_multi_value_transformer"
transformation:
type: "person_generator"
column_templates: ["${full_name}"]
mask_sub_values: true
Properties
-
type = json_multi_value_transformer
Compatible modes: MASKING
Compatible column data types: ANY
Supports multiple columns: No
T24 id remap
Deterministically remaps a T24 RECID (or a reference to one) to a new id for the T24 reseed feature. The body of the id is produced by format-preserving encryption, which is value-keyed (same input always yields the same output, so a reference column stays consistent with its remapped primary key) and injective (distinct inputs yield distinct outputs, so distinct source ids remain distinct after remapping). A constant reserved prefix is prepended so that minted ids sit in a namespace that is disjoint from the real ids they are appended beside. With a numeric prefix, a numeric input stays numeric. Null or blank values pass through unchanged.
Example:
transformations:
- columns: ["RECID"]
params:
type: "t24_id_remap"
prefix: "9"
Properties
-
type = t24_id_remap
Compatible modes: MASKING
Compatible column data types: TEXT
Supports multiple columns: No
Void generator
An auxiliary transformer that throws an error when called. It is used only when it is necessary to ignore the processing of the entire table.
Properties
-
type = void_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: Yes
Scripting transformer
The scripting transformer allows you to implement own logic for both the GENERATION mode and the MASKING mode.
Currently only Javascript implementation is supported.
The script for GENERATION mode must define a lambda function that returns a dictionary where keys are column names, and the values are the desired values of the record.
If a transformer is applied to a single column, the value may be returned instead of a dictionary.
The script for the MASKING mode must define a lambda function with the two arguments ctx and originalRecord.
The following example shows how to use a custom script in MASKING mode.
transformations:
- columns:
- title
params:
type: scripting_transformer
language: "JAVASCRIPT"
script:
code: |
(ctx, originalRecord) => {
const title = originalRecord.get("title");
return title.split(' ').reverse().join(' ');
}
The script for the GENERATION mode should define a lambda function with the single argument ctx.
The following example shows how to use a custom script for GENERATION:
transformations:
- columns:
- credit_card
params:
type: scripting_transformer
language: "JAVASCRIPT"
init_script:
code: |
/**
* @returns {String}
*/
function generateRandomCreditCardNumber() {
let creditCardNumber = 4
for (let i = 1; i < 16; i++) {
const digit = Math.floor(Math.random() * 10);
creditCardNumber += digit.toString();
}
return creditCardNumber;
}
script:
code: |
/**
* @typedef { Object.<string, *> | * } Result
*
* @param {GenerationContext} ctx
* @returns {Result}
*/
(ctx) => generateRandomCreditCardNumber();
Properties
-
type = scripting_transformer
Compatible modes: GENERATION, MASKING
Compatible column data types: ANY
Supports multiple columns: Yes
Arithmetic generator
The output column is filled with values that are calculated from other columns based on the given expression. A basic use case would be converting one unit to another, e.g., converting Celsius to Fahrenheit:
transformations:
- columns: ["temperature_fahrenheit"]
params:
type: arithmetic_generator
expression: "temperature_celsius * 9 / 5 + 32"
The generator can also include more complex expressions that incorporate other generators. Additionally, it supports basic date arithmetic based on epoch milliseconds:
transformations:
- columns: ["card_expiry_date"]
params:
type: arithmetic_generator
expression: "card_issue_date + card_validity_period + 1d"
variables:
"card_validity_period":
type: categorical_generator
categories:
value_source: PROVIDED
values:
"730d": 0.5
"1461d": 0.5
Expressions in the arithmetic_generator can refer to columns within the current table, or columns in parent tables. To refer to a column in the current table, supply the column name. To refer to another table, use the syntax schema_name.table_name.column_name.
table_name_with_schema: public.transaction
transformations:
- columns: [ "creation_date" ]
params:
type: arithmetic_generator
variables:
"days_between_card_issue_and_transaction":
type: continuous_generator
max: 365
mean: 180
std: 100
min: 1
numeric_type: INT
expression: public.card.card_issue_date + 1d * days_between_card_issue_and_transaction
The current table must have a foreign key relationship with the parent table and a foreign_key_generator must be configured correctly.
| If the foreign key required by the generator is not present in your database schema, you can define a virtual foreign key as shown here |
In addition, expressions can reference the original (input) value of a column from the current table by using the ORIGINAL prefix. To refer to the original value of a column, use the syntax ORIGINAL.column_name.
The ORIGINAL prefix is not supported in GENERATION mode.
|
Properties
-
type = arithmetic_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: NUMERIC, DATE
Supports multiple columns: No
Sieve generator
The output column is filled with values that are sampled from a given distribution and rejected if they do not satisfy a given condition. The process is repeated until a valid value is found. Example:
transformations:
- columns: ["start"]
params:
type: date_generator
- columns: ["finish"]
params:
type: sieve_generator
condition: "finish > start + 1h"
generator:
type: date_generator
Conditions in the sieve_generator can refer to columns within the current table, or columns in parent tables. To refer to a column in the current table, supply the column name. To refer to another table, use the syntax schema_name.table_name.column_name.
table_name_with_schema: public.transaction
transformations:
- columns: ["creation_date"]
params:
type: sieve_generator
condition: creation_date > public.card.card_issue_date && creation_date < public.card.card_expiry_date
generator:
type: date_generator
The current table must have a foreign key relationship with the parent table and a foreign_key_generator must be configured correctly.
| If the foreign key required by the generator is not present in your database schema, you can define a virtual foreign key as shown here |
If the provided condition is too narrow the generator may struggle to find a valid value. In such cases, it is recommended to adjust the condition or use another generator like arithmetic_generator.
|
Properties
-
type = sieve_generator
Compatible modes: GENERATION, MASKING
Compatible column data types: NUMERIC, DATE
Supports multiple columns: Yes