Created 05-23-2023 08:56 AM
I have a flow that processes CSVs and towards the end of processing I need to capture the success and failed records count in a SQL table
Created on 06-16-2023 05:39 AM - edited 06-16-2023 05:42 AM
@nuxeo-nifi Wanted to first make some suggestions to help us better respond:
Not knowing this, we have to make some assumptions that could possibly result in providing an inaccurate solution or turn the post into long drawn out dialouge, versus simple question, and direct answer/solution.
Making those assumptions, I could assume at the bottom of your flow, you have a success and failure relationship. One suggestion would be to use (MergeRecord/MergeContent) to obtain the counts, then maybe replaceText to fabricate the counts into correct shape flowfile and route to an ExecuteSQL processor to execute your SQL statements.
Another alternative solution could be to send errors and success to separate ExecuteSQL processors in a way that for each flowfile it just executes a SQL statement that increments the existing count. This would save the need to merge and get totals. Maybe like these in each ExecuteSQL:
UPDATE table SET success = success +1 WHERE tablename ='something' UPDATE table SET errors = errors +1 WHERE tablename ='something'