Click to copy
Types • Reviewed for ksqlDB 0.29
How to Insert Struct Values in ksqlDB
Use the STRUCT()
function to create new struct
values
:
INSERT INTO scores_stream(
score,
user
) VALUES (
3.8,
STRUCT(name := 'Alice', age := 30)
);
For
reference,
the scores_stream
was created with the statement below:
CREATE STREAM scores_stream (
score DOUBLE,
user STRUCT<name STRING, age INT>
) WITH (
KAFKA_TOPIC = 'scores_topic',
VALUE_FORMAT = 'JSON',
PARTITIONS = 10
);
Remember that y
ou can nest STRUCT()
calls
to create nested structures.
Was this article helpful?