all-things-risingwave

How to create a Kafka source with column select if payload is in array form?

I have to create a Kafka source from topic with payload in array format. The payload structure includes 'transactionDetails' array and 'createdOn' field. How can I create a source with column select for this scenario?

Vi

Vijay Shankar

Asked on Sep 08, 2023

  1. Create a table with 'transactionDetails' as JSONB and 'createdOn' as TIMESTAMP:
create table t(
   transactionDetails jsonb,
   createdOn TIMESTAMP
) with (...);```

2. Use SQL functions to access elements in the JSONB column:
- Refer to [Retrieve Data from a JSONB Column and Casting](https://docs.risingwave.com/docs/current/data-type-jsonb/#retrieve-data-from-a-jsonb-column-and-casting)
- Utilize SQL functions for JSON operations as mentioned in [SQL Function JSON Documentation](https://docs.risingwave.com/docs/current/sql-function-json/)
Sep 08, 2023Edited by