My config file of sink contains the following configurations -
...
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"tasks.max": "1",
"topics": "DELETESRC",
"insert.mode": "upsert",
"batch.size": "50000",
"table.name.format": "DELETESRC",
"pk.mode": "record_key",
"pk.fields": "ID,C_NO",
"delete.enabled": "true",
"auto.create": "true",
"auto.evolve": "true",
"max.retries": "10",
"retry.backoff.ms": "3000",
"mode": "bulk",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "io.confluent.connect.avro.AvroConverter",
"value.converter.schemas.enable": "true",
"value.converter.schema.registry.url": "http://localhost:8081",
"transforms": "ValueToKey",
"transforms.ValueToKey.type":"org.apache.kafka.connect.transforms.ValueToKey",
"transforms.ValueToKey.fields": "ID,C_NO"
...
I am able to use upsert using the keys but not able to use the delete mode in the JDBC sink.
I configured the topic DELETESRC
as cleanup.policy=compact
, delete.retention.ms=0
.
I created a KSQL stream as with 4 columns (ID,CMP,SEG,C_NO
) and using the insert into statements in KSQL to push the data.
INSERT INTO DELETESRC VALUES ('null','11','D','1','3')
INSERT INTO DELETESRC VALUES ('null','11','C','1','4')
INSERT INTO DELETESRC VALUES ('null','12','F','1','3')
But when I am doing INSERT INTO DELETESRC VALUES ('null','11','null','null','3')
, the sink is updating the table as 11,null,null,3
.
I have looked into other answers in stack-overflow but those solutions did not work.
Am I doing any mistake in creating a tombstone record?
I tried other ways in insert statement in KSQL but the delete operation is not occurring.