[英]Kafka Connect JDBC Sink Connector: How to delete a record that doesn't have a NULL value?
Is there a (recommended) way to delete a record from a Kafka Connect JDBC Sink Connector where the record's value is not NULL?是否有(推荐的)方法可以从 Kafka Connect JDBC Sink 连接器中删除记录值不为 NULL 的记录?
For example, if my JSON configuration includes the following:例如,如果我的 JSON 配置包括以下内容:
...
"delete.enabled": "true",
"pk.mode": "record_key",
...
And my record's value is non-null, is there a way to have that record be deleted in the database?并且我的记录的值是非空的,有没有办法在数据库中删除该记录?
I ask because the record's value has a field that marks if it should be deleted ie a column like "Operation" where "Operation" == "D" should be a delete in the database via JDBC.我问是因为记录的值有一个字段来标记它是否应该被删除,即像“Operation”这样的列,其中“Operation”==“D”应该是通过JDBC在数据库中删除。
If there is a standard/recommended way to do this I would love to hear it.如果有标准/推荐的方法来做到这一点,我很乐意听到。 My only other idea was to make a custom transform that checks the "Operation" column for the value "D" and if it is a match, we pass back the record with the PK intact but with the value set to NULL aka a tombstone record which should get picked up by the connector as a delete operation.
我唯一的其他想法是进行自定义转换,检查“操作”列中的值“D”,如果匹配,我们将 PK 完好无损地传回记录,但将值设置为 NULL 又名墓碑记录连接器应该将其作为删除操作拾取。 Is that a possibility?
有这种可能吗?
I appreciate any help, thank you!我感谢任何帮助,谢谢!
No responses yet but I got my somewhat hacky solution to work:还没有回应,但我得到了我有点笨拙的解决方案:
Hope this helps希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.