How can I get the Nifi ExecuteSQL processor COUNT(*) Result and use it in PutSQL processor?

620 Views Asked by At

I have a table (T1) that is inserted frequently. I want to check whether the insertions successful. I have another table (T2) to store the row counts of this table.

I used ExecuteSQL processor to send SELECT COUNT(*) query against the T1. I want to put the result into T2 with PutSQL processor.

Can I get the result of the query using flowfile attributes?

1

There are 1 best solutions below

0
On BEST ANSWER

If you are allowed to use custom processor then use below which does the same, creating FlowFile attributes from SQL query resultset instead of replacing FlowFile content, have a look at source code also. There is an alternative approach using DistributedMapCache implementation.

  1. UpdateAttributesFromSQL
  1. Alternate approach mentioned here