[KAFKA-321] Add support for Template Writes Created: 20/Jul/22  Updated: 14/Aug/23

Status: Backlog
Project: Kafka Connector
Component/s: Sink
Affects Version/s: None
Fix Version/s: 1.12.0

Type: New Feature Priority: Unknown
Reporter: Ross Lawley Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Quarter: FY24Q3
Case:

 Description   

Consider adding flexibility to write models by providing a template based solution.

Example configuration:

writemodel.strategy = TemplateBasedWriteModelStrategy
writemodel.template.model = UpdateOne
writemodel.template.options.upsert = true
writemodel.template.query = "{'_id': '${v._id}'}"
writemodel.template.update = "{'$set': {'b': '${k.b}', '$addToSet': {'a': '${v.a}'}}"

SinkRecord:

key: {a: 1, b: 2}
value: {_id: 1, a: 'alpha'}

Write Model:

UpdateOne({_id: 1}, {$set: {b: 2}, $addToSet: {a: 'alpha'}}, new UpdateOneOptions().upsert(true))

The logic would be to handle special fields that contain a templated value eg: ${v._id} would be the _id field from the value document in the Sink Record. ${k.b} would be the b field from the key document in the Sink Record.


Generated at Thu Feb 08 09:06:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.