Vignesh Manivasagan
Vignesh Manivasagan

Reputation: 101

Kafka JDBC sink connector - is it possible to store the topic data as a json in DB

Kafka JDBC sink connector - is it possible to store the topic data as a json into the postgre DB. Currently it parse each json data from Topic and map it to the corresponding column in the table.

If anyone has worked on a similar case, can you please help me what are the config details I should add inside the connector code.

I used the below code. But, it didn't work.

"key.converter":"org.apache.kafka.connect.storage.StringConverter",
"key.converter.schemas.enable":"false",
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable":"false"

Upvotes: 0

Views: 898

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191725

The JDBC sink requires a Struct type (JSON with Schema, Avro, etc)

If you want to store a string, that string needs to be the value of a key that corresponds to a database column. That string can be anything, including delimited JSON

Upvotes: 1

Related Questions