Course: ksqlDB 101

Hands On: Transforming Data with ksqlDB

2 min
Allison WaltherIntegration Architect (Course Presenter)

Hands On: Transforming Data with ksqlDB

Continuing with the orders stream from previous exercises, this exercise teaches you how to transform data in ksqlDB.

Query an Existing Stream and Inspect the Data

  1. Begin by selecting everything from the orders stream:

    SELECT * FROM orders EMIT CHANGES;

    Click Run query.

  2. Scroll down to see the returned records. View the structure of one of the records by clicking on the caret in its upper left-hand corner.

    structure

    Now Stop your orders query.

Create a Persistent Transformation

  1. Create a persistent transformation with no address data:

    CREATE STREAM orders_no_address_data AS
    SELECT TIMESTAMPTOSTRING(ordertime, 'yyyy-MM-dd HH:mm:ss') AS order_timestamp, orderid, itemid, orderunits
    FROM orders EMIT CHANGES;

Inspect the Transformed Stream

  1. Now select from the transformed stream:

    SELECT * FROM orders_no_address EMIT CHANGES;

    Click Run query.

    Expand the record to see the transformed data.

Use the promo code KSQLDB101 to get $101 of free Confluent Cloud usage

Be the first to get updates and new content

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.