Reputation: 6593
I'm configuring Kafka Connect to copy data from Kafka to Database
I need to put value from some field to two column in Database .
My Kafka Message has two fields name
, age
. Target table has 3 columns name
, displayName
and age
. I would like to clone value of name
from Kafka message to put it in both columns name
and displayName
.
Is there any Transform, that can by applied to do that?
Upvotes: 3
Views: 1288
Reputation: 32090
As Driss Nejjar says, this would typically be the kind of thing that a Single Message Transform would be perfect for. However, there is no Transform that ships with Apache Kafka that I can see that would do this. You could write your own, or you could also use KSQL:
CREATE STREAM new AS SELECT name, name as displayName, age FROM source;
This would take your source
topic (populated by Connect), and add the additional field displayName
, and write to a new Kafka topic called new
.
Disclaimer: I work for Confluent, the company behind the KSQL project.
Upvotes: 2