# Transformers

> Source: https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/
> For the complete documentation index, see [llms.txt](https://docs.synthesized.io/llms.txt).

A transformer writes the values of one or more columns. Set it with `type:` in a table’s `transformations`. This page groups the transformers by what they do. Each name links to its entry in [All Transformers](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations), which lists its parameters and examples.

```yaml
tables:
  - table_name_with_schema: "public.customer"
    transformations:
      - columns: ["email"]
        params:
          type: person_generator
          column_templates: ["${email}"]
```

## Reading the tables

- **Modes**: every transformer works in MASKING mode. Most also work in GENERATION. The exceptions, which only change existing values, are the transformers in [Masking existing values](#_masking_existing_values) and [JSON, XML and multi-value columns](#_json_xml_and_multi_value_columns), and `passthrough`.
- **Columns**: the column types a transformer accepts. **Any** means any type. See [Data Types](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/data_types/).
- **Several columns**: transformers that can write several columns at once, keeping their values consistent with each other, say so in their description.

## If you don’t set a transformer

You don’t need to set a transformer for every column. Columns you don’t list get one from the rules in `default_config`:

- In **KEEP** mode, columns are copied with `passthrough`.
- In **MASKING** mode, every column gets a masking transformer. Primary and foreign keys get a hashing transformer, such as `unique_hashing` for numeric keys, so keys change but joins still work. If no rule matches a column, `safety_mode: STRICT` (the default) stops the run.
- In **GENERATION** mode, the engine learns each column from the input and picks a generator.

Run `tdk default-config` to see the rules. See [How Masking Works](https://docs.synthesized.io/tdk/latest/user_guide/030_core_concepts/how_masking_works) and [How Generation Works](https://docs.synthesized.io/tdk/latest/user_guide/030_core_concepts/how_generation_works).

## People, addresses and financial data

  
| Transformer | What it does | Columns |
| --- | --- | --- |
| 
[`person_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#PersonGeneratorParams)

 | 

Names, titles, emails, usernames, company names, phone numbers and social security numbers. Takes several columns and keeps a row’s values consistent. Supports many locales.

 | 

Text

 |
| 

[`address_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#AddressGeneratorParams)

 | 

Street names, house and flat numbers, cities, regions, postcodes, countries, coordinates and time zones. Takes several columns and keeps a row’s values consistent.

 | 

Text

 |
| 

[`finance_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#FinanceGeneratorParams)

 | 

Card numbers by card type, IBAN and BIC codes, US routing numbers, stock tickers and stock markets. Takes several columns.

 | 

Text

 |

## Masking existing values

These transformers work in MASKING mode only.

  
| Transformer | What it does | Columns |
| --- | --- | --- |
| 
[`format_preserving_hashing`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#FormatPreservingHashingParams)

 | 

Replaces characters with others from the same group, such as digits with digits, so the value keeps its length and format. Can be limited to the first or last characters, a substring, a regex or a set of characters. Not reversible.

 | 

Text

 |
| 

[`redaction`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#RedactionParams)

 | 

Masks the first or last characters of a value with a mask character, or keeps them and masks the rest: for example, keep the last 4 digits of a card number.

 | 

Text

 |
| 

[`noising`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#NoisingParams)

 | 

Adds random noise to numbers, so values stay close to the originals.

 | 

Numeric

 |
| 

[`unique_hashing`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#UniqueHashingParams)

 | 

Hashes values to unique outputs. The same input always gives the same output, so keys stay joinable. MASKING uses it for numeric keys.

 | 

Numeric

 |
| 

[`date_time_unique_hashing`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#DateTimeUniqueHashingParams)

 | 

Hashes date and time values to unique outputs, consistently. MASKING uses it for date keys.

 | 

Date

 |
| 

[`enum_unique_hashing`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#EnumUniqueHashingParams)

 | 

Hashes enum values to unique outputs, consistently.

 | 

Text

 |
| 

[`t24_id_remap`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#T24IdRemapParams)

 | 

Remaps Temenos T24 record IDs, and references to them, to new IDs. The same input always gives the same output.

 | 

Text

 |

## Sampling from distributions

  
| Transformer | What it does | Columns |
| --- | --- | --- |
| 
[`categorical_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#CategoricalGeneratorParams)

 | 

Picks values from categories with weights. You provide the categories, read them from a CSV file, or let the engine learn them from the input. Learned categories are real input values. Can take several columns.

 | 

Any

 |
| 

[`continuous_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#ContinuousGeneratorParams)

 | 

Samples numbers from a distribution. You give its parameters, or the engine fits them to the input.

 | 

Numeric

 |
| 

[`quantile_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#QuantileGeneratorParams)

 | 

Samples numbers from bins, each chosen with a given probability.

 | 

Numeric

 |
| 

[`date_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#DateGeneratorParams)

 | 

Samples dates from a distribution. You give its parameters, or the engine fits them to the input.

 | 

Date

 |
| 

[`sieve_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#SieveGeneratorParams)

 | 

Samples values from a distribution and keeps only those that meet a condition. Can take several columns.

 | 

Numeric, date

 |

## Keys, sequences and identifiers

  
| Transformer | What it does | Columns |
| --- | --- | --- |
| 
[`int_sequence_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#IntSequenceGeneratorParams)

 | 

Unique integers in sequence, for ID columns.

 | 

Numeric

 |
| 

[`string_sequence_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#StringSequenceGeneratorParams)

 | 

Unique strings in sequence, from upper-case letters and digits.

 | 

Text

 |
| 

[`uuid_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#UuidGeneratorParams)

 | 

UUIDs.

 | 

Any

 |
| 

[`formatted_string_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#FormattedStringGeneratorParams)

 | 

Strings that match a regular expression. Without a pattern, random characters about as long as the original.

 | 

Any

 |
| 

[`foreign_key_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#ForeignKeyGeneratorParams)

 | 

Fills foreign keys with the primary key values of parent rows. The platform sets it up wherever related tables are generated: don’t set it yourself.

 | 

Any

 |
| 

[`unique_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#UniqueGeneratorParams)

 | 

For primary keys that are also part of a foreign key. The platform sets it up: don’t set it yourself.

 | 

Any

 |

## Copying, constants and empty values

  
| Transformer | What it does | Columns |
| --- | --- | --- |
| 
[`passthrough`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#PassthroughParams)

 | 

Copies the input value unchanged. MASKING mode only. Can take several columns.

 | 

Any

 |
| 

[`null_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#NullGeneratorParams)

 | 

Fills the column with nulls. Can take several columns.

 | 

Any

 |
| 

[`default_value`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#DefaultValueGeneratorParams)

 | 

One value for the whole column: the one you give, or a default for the column’s type.

 | 

Any

 |
| 

[`constant_numeric`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#ConstantNumericGeneratorParams)

 | 

One number for the whole column.

 | 

Numeric

 |
| 

[`constant_string`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#ConstantStringGeneratorParams)

 | 

One string for the whole column.

 | 

Text

 |
| 

[`constant_date`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#ConstantDateGeneratorParams)

 | 

One date for the whole column.

 | 

Date

 |
| 

[`constant_boolean`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#ConstantBooleanGeneratorParams)

 | 

One boolean for the whole column.

 | 

Boolean

 |
| 

[`constant_xml`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#ConstantXmlGeneratorParams)

 | 

One XML value for the whole column.

 | 

Any

 |
| 

[`void_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#VoidGeneratorParams)

 | 

Skips the processing of a whole table. In XML generation, it removes the selected attribute or text node.

 | 

Any

 |

## JSON, XML and multi-value columns

These transformers work in MASKING mode only.

  
| Transformer | What it does | Columns |
| --- | --- | --- |
| 
[`json_pointer_transformer`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#JsonPointerTransformerParams)

 | 

Transforms the JSON values that JSON pointers select, and keeps the rest of the document.

 | 

Any

 |
| 

[`xpath_transformer`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#XPathTransformerParams)

 | 

Transforms the XML nodes that XPath expressions select, and keeps the rest of the document.

 | 

Any

 |
| 

[`json_multi_value_transformer`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#JsonMultiValueTransformerParams)

 | 

Masks each value in a Temenos T24 multi-value column stored as JSON, with an inner transformer.

 | 

Any

 |

## Logic and custom code

  
| Transformer | What it does | Columns |
| --- | --- | --- |
| 
[`conditional_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#ConditionalGeneratorParams)

 | 

Uses one of two transformers, depending on whether a column has a given value. Can take several columns.

 | 

Any

 |
| 

[`arithmetic_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#ArithmeticGeneratorParams)

 | 

Computes values from other columns with an expression, such as a unit conversion.

 | 

Numeric, date

 |
| 

[`loop_generator`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#LoopGeneratorParams)

 | 

Writes values from a list in order, and starts again at the end of the list unless `repeatable` is off. Several columns can take values that always appear together.

 | 

Any

 |
| 

[`scripting_transformer`](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations#ScriptingTransformerParams)

 | 

Runs your own JavaScript, for one or several columns. See [Scripting Transformer](https://docs.synthesized.io/tdk/latest/user_guide/020_guides/advanced_workflows/scripting_transformer).

 | 

Any

 |

## Consistent values

Eight generators take `consistent_with_column`: `person_generator`, `address_generator`, `finance_generator`, `date_generator`, `uuid_generator`, `continuous_generator`, `quantile_generator` and `formatted_string_generator`. Rows with the same value in the named column get the same output.

The default, `self`, makes the output depend on the column’s own input value. In masking, the same input then always gets the same output.

## See also

- [All Transformers](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers/transformations): every parameter, with examples.
- [Mask a Database](https://docs.synthesized.io/tdk/latest/user_guide/020_guides/masking_data/masking): choosing transformers for a masking workflow.
- [Column transformations](https://docs.synthesized.io/tdk/latest/user_guide/040_reference/configuration/#_column_transformations): the keys around `params`.
