Skip to main content
Skip to main content

generateRandom Table Function

Generates random data with a given schema. Allows populating test tables with that data. Not all types are supported.

Syntax

Arguments

ArgumentDescription
nameName of corresponding column.
TypeNameType of corresponding column.
random_seedSpecify random seed manually to produce stable results. If NULL — seed is randomly generated.
max_string_lengthMaximum string length for all generated strings. Defaults to 10.
max_array_lengthMaximum elements for all generated arrays or maps. Defaults to 10.

Returned value

A table object with requested schema.

Usage Example

In combination with generateRandomStructure:

With missing structure argument (in this case the structure is random):

With random seed both for random structure and random data:

note

generateRandom(generateRandomStructure(), [random seed], max_string_length, max_array_length) with a large enough max_array_length can generate a really huge output due to possible big nesting depth (up to 16) of complex types (Array, Tuple, Map, Nested).