Reputation: 1079
How to use PutDatabaseRecord to UPDATE only three columns of a table named student having several columns? I am trying to achieve following query with where clause using NiFi.
update student set class=v1,name=v2,section=v3 where
id = v4
I am getting the values v1,v2,v3,v4 using ExecuteSQL processor. There can be 100 of students registered on the same date. So, v1,v2,v3,v4 will be array of json
SELECT class,name,section,id
FROM registration where registerd_on='20210530';
My PutDatabaseRecord config. I want to understand how to specify where condition here?
Upvotes: 1
Views: 4544
Reputation: 28564
according to documentation
Update keys
- A comma-separated list of column names that uniquely identifies a row.
So you have to set Update keys = id
if you have just one column id
as table row identifier.
About tracking sql queries. Try to add following line into conf\logback.xml
<logger name="org.apache.nifi.processors.standard.PutDatabaseRecord" level="DEBUG"/>
sometimes sql should appear in logs but truly i cant understand the logic in code...
Upvotes: 1