Datagen connector

The Datagen connector generates rows of random or sequential data. It is a source only, and it needs no external system. Use it to try out Cloudera SQL Stream Builder, or to test a query with generated data.

Example

The connector works without mandatory properties other than connector. When a column has no settings, Datagen fills it with random values of the type of the column.

CREATE TABLE orders_gen (
  order_id INT,
  amount DOUBLE,
  order_time AS LOCALTIMESTAMP
) WITH (
  'connector' = 'datagen',
  'rows-per-second' = '5',
  'fields.order_id.kind' = 'sequence',
  'fields.order_id.start' = '1',
  'fields.order_id.end' = '100000',
  'fields.amount.min' = '1',
  'fields.amount.max' = '500'
);

Properties

Table 1. Properties of the Datagen connector
PropertyDescription
connectordatagen
rows-per-secondThe number of rows per second. The default is 10000.
number-of-rowsThe total number of rows. By default, the table is unbounded.
fields.<column>.kindrandom or sequence. The default is random.
fields.<column>.min and fields.<column>.maxThe range of a random number column.
fields.<column>.start and fields.<column>.endThe range of a sequence column.
fields.<column>.lengthThe length of a string, array, map, or multiset column. The default is 100.

For the full list of options, see DataGen SQL connector in the Apache Flink documentation.