This exercise will teach you how to change data formats in ksqlDB.
Begin by printing your
orders_flat stream from Hands On: Flatten Nested Records with ksqlDB to show the existing JSON data:
PRINT orders_flat FROM BEGINNING;
Click Run query.
Stop the query. Then expand a record to see the JSON structure.
CREATE STREAM AS statement, with
VALUE_FORMAT set to
CREATE STREAM orders_csv WITH(VALUE_FORMAT='delimited', KAFKA_TOPIC='orders_csv') AS SELECT * FROM orders_flat EMIT CHANGES;
Click Run query. This will help to clean up the JSON you saw in Step 2.
PRINT orders_csv FROM BEGINNING;
Click Run query, then scroll down and expand a record to see the comma-delimited fields.
It's as easy as that:
VALUE_FORMAT helps you to change formats within ksqlDB.
We will only share developer content and updates, including notifications when new content is added. We will never send you sales emails. 🙂 By subscribing, you understand we will process your personal information in accordance with our Privacy Statement.