Create a stream with a struct key in KSQL

Viewed 40

How can I create a KSQL stream with a struct as key?

1 Answers
ksql> CREATE STREAM S1 (k STRUCT<k int> KEY, v VARCHAR) WITH (kafka_topic='s1', partitions=1, key_format='avro', value_format='avro');


ksql> INSERT INTO s1 (k, v) VALUES (STRUCT(k := 1), 'foo');

You can also refer the following doc for dealing with other structured data types - https://docs.ksqldb.io/en/latest/how-to-guides/query-structured-data/

Related