2

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

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
jelmew
  • 543
  • 1
  • 7
  • 15

1 Answers1

1
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/

Bonnie Varghese
  • 2,158
  • 1
  • 16
  • 11