This documentation is for an out-of-date version of Apache Flink. We recommend you use the latest stable version.

DataGen SQL Connector

Scan Source: Bounded Scan Source: UnBounded

The DataGen connector allows for reading by data generation rules.

The DataGen connector can work with Computed Column syntax. This allows you to generate records flexibly.

The DataGen connector is built-in.

Attention Complex types are not supported: Array, Map, Row. Please construct these types by computed column.

How to create a DataGen table

The boundedness of table: when the generation of field data in the table is completed, the reading is finished. So the boundedness of the table depends on the boundedness of fields.

For each field, there are two ways to generate data:

  • Random generator is the default generator, you can specify random max and min values. For char/varchar/string, the length can be specified. It is a unbounded generator.
  • Sequence generator, you can specify sequence start and end values. It is a bounded generator, when the sequence number reaches the end value, the reading ends.
CREATE TABLE datagen (
 f_sequence INT,
 f_random INT,
 f_random_str STRING,
 ts AS localtimestamp,
) WITH (
 'connector' = 'datagen',

 -- optional options --





Connector Options

Option Required Default Type Description
required (none) String Specify what connector to use, here should be 'datagen'.
optional 10000 Long Rows per second to control the emit rate.
optional random String Generator of this '#' field. Can be 'sequence' or 'random'.
optional (Minimum value of type) (Type of field) Minimum value of random generator, work for number types.
optional (Maximum value of type) (Type of field) Maximum value of random generator, work for number types.
optional 100 Integer Length for string generating of random generator, work for char/varchar/string.
optional (none) (Type of field) Start value of sequence generator.
optional (none) (Type of field) End value of sequence generator.