This documentation is available to agents as Markdown at https://docs.synthesized.io/tdk/latest/user_guide/040_reference/transformers.md. For the complete documentation index, see llms.txt.

Transformers

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, which lists its parameters and examples.

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 and JSON, XML and multi-value columns, and passthrough.

  • Columns: the column types a transformer accepts. Any means any type. See 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 and How Generation Works.

People, addresses and financial data

Transformer What it does Columns

person_generator

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

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

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

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

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

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

Numeric

unique_hashing

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

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

Date

enum_unique_hashing

Hashes enum values to unique outputs, consistently.

Text

t24_id_remap

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

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

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

Numeric

quantile_generator

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

Numeric

date_generator

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

Date

sieve_generator

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

Unique integers in sequence, for ID columns.

Numeric

string_sequence_generator

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

Text

uuid_generator

UUIDs.

Any

formatted_string_generator

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

Any

foreign_key_generator

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

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

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

Any

null_generator

Fills the column with nulls. Can take several columns.

Any

default_value

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

Any

constant_numeric

One number for the whole column.

Numeric

constant_string

One string for the whole column.

Text

constant_date

One date for the whole column.

Date

constant_boolean

One boolean for the whole column.

Boolean

constant_xml

One XML value for the whole column.

Any

void_generator

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

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

Any

xpath_transformer

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

Any

json_multi_value_transformer

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

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

Any

arithmetic_generator

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

Numeric, date

loop_generator

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

Runs your own JavaScript, for one or several columns. See 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