What's the best way to update rows in a database with before and after values by NiFi
Hi everyone!
I have json from kafka:
[ {
"before" : {
"old_key1" : old_value1,
"old_key2" : old_value2,
"old_key3" : old_value3,
"old_key4" : old_value4
},
"after" : {
"new_key1" : new_value1,
"new_key2" : new_value2,
"new_key3" : new_value3,
"new_key4" : new_value4
},
"table" : "table_name",
"op" : "u", -- operation ['u-update', 'c-insert', 'd-delete']
"tm" : 1720539441000000000 - timestamp of changes
} ]I need execute on database sql like:
update table_name
set new_key1=new_value1,
new_key2=new_value2,
new_key3=new_value3,
new_key4=new_value4
where
old_key1=old_value1 and
old_key2=old_value2 and
old_key3=old_value3 and
old_key4=old_value4;What's the best way to update rows in a database with before and after values by NiFi. I can`t use a groovy script because our team know sql only and if I produce it on groovy, I must support this alone. I have tried create sql by jolt, but all values without quotes and I can`t test a type. I think a have two ways: 1) insert all data to sql and create sql by sql 2) Create new Processor with ability of create the sql (But 🙂 I can do it by groovy)

