Skip to main content

random_string

Generate a random string using the provided characters within the specified length range.

Parameters

NameDescriptionDefaultRequiredSupported DB types
columnThe name of the column to be affectedYestext, varchar, char, bpchar, citext
min_lengthThe minimum length of the generated stringYes-
max_lengthThe maximum length of the generated stringYes-
symbolsThe range of characters that can be used in the random stringabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZNo-
keep_nullIndicates whether NULL values should be replaced with transformed values or nottrueNo-
engineThe engine used for generating the values [random, hash]. Use hash for deterministic generationrandomNo-

Description

The RandomString transformer generates a random string with a length between min_length and max_length using the characters specified in the symbols string as the possible set of characters. The behaviour for NULL values can be configured using the keep_null parameter.

The engine parameter allows you to choose between random and hash engines for generating values. Read more about the engines in the Transformation engines section.

Example: Generate a random string for accountnumber

In the following example, a random string is generated for the accountnumber column with a length range from 9 to 12. The character set used for generation includes 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ.

RandomString transformer example
- schema: "purchasing"
name: "vendor"
transformers:
- name: "RandomString"
params:
column: "accountnumber"
min_length: 9
max_length: 12
symbols: "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Result

ColumnOriginalValueTransformedValue
accountnumberAUSTRALI00014VUI6P2OZ
Copyright © GreenMask 2026