'Kafka Connect JDBC Connector Sink - Update table values using a field that is in the key used as the pk.fields

We would like to configure a connector using the below schema:

Key

id: String
status: String

Value:

status: String

We would like to use the key to identify the rows in the database to update, and use the value field's to update the given fields in the db. However, it seems that the connector wants to only allow one usage of the status field. Is this achievable?

Ideally, we would like the update statements to look something like this:

UPDATE myTable 
set status = value.status
where status = key.status and id = key.id

We have tried the below configuration, but it is not giving the expected result:

pk.mode=record_key
pk.fields=status,id

This currently results in the below query (note that it is missing the key.status in the set fields):

UPDATE "public"."myTable" SET  
WHERE "id" = 'idgoeshere' AND "status" = 'ENABLED' 

Any input on this would be appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source