Get Started Free
‹ Back to courses
course: ksqlDB 101

Transforming Data with ksqlDB

2 min
Allison

Allison Walther

Integration Architect (Presenter)

Transforming Data with ksqlDB

ksqlDB allows you to transform events in one stream and then send them to a new stream. For example, you may want to change a Unix timestamp to a human-readable format, or you may want to remove sensitive fields from a stream for broader use within a company.

ksqlDB can be used to perform many common transformations required when handling data, including:

  • Changing data types (CAST)
  • Reformatting date/time fields (TIMESTAMPTOSTRING)
  • Changing field names (AS)
  • Dropping fields
  • Concatenating fields (CONCAT)

When creating a new stream from an existing one, you can pick and choose the fields you’d like to preserve in the new stream. You can also use functions to modify data or to create derived fields.

For example, here is how to convert the timestamps on your orders from the Unix epoch value to a more friendly data format:

orders-no-address

There is really no limit to the transformations you can perform with ksqlDB.

Use the promo code KSQLDB101 & CONFLUENTDEV1 to get $25 of free Confluent Cloud usage and skip credit card entry.

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.

Transforming Data with ksqlDB

Hi, I'm Allison Walther with Confluent. Let's talk about transforming data with ksqlDB. KsqlDB allows us to transform our events, while creating a new stream. For example, we can change a Linux timestamp to a human-readable format, or we can remove sensitive fields from the event. When creating a new stream based on an existing one, we can pick and choose which fields we want to exist in the new stream. This allows us, for example, to provide a sanitized stream that is fit for broader use within a company. We can also use functions to modify data or create derived fields. In this example, we are using the timestamptostring function to convert the Linux epoch value to a more friendly data format, but there's really no limit to the transformations we can perform with ksqlDB. That's it for transforming data with ksqlDB, we're gonna move on to an exercise.