Assigning keys to Kafka tables
A Kafka record can have a key in addition to its value. The key decides the partition that a record is written to. You assign keys in the query or in the DDL.
The Kafka table editor has no setting for keys.
Assign a key in a query
In a query that writes to a Kafka table, name the column that you want as the key
_eventKey. For example:
SELECT sensor_name AS _eventKey
FROM sensors
WHERE eventTimestamp > current_timestamp;
Assign a key in DDL
In a table that you create with DDL, set key.format and
key.fields in the WITH clause. For example,
'key.format' = 'json' and 'key.fields' =
'sensor_name'. For more information, see Kafka connector.
