Support Questions

Find answers, ask questions, and share your expertise

How to insert into db in order file contains the data using PutFile or PutDatabaseRecord in NiFI

avatar
Contributor

I have a simple file having say 1000 lines each of which contains say username and useraddress. I need to insert it into db. How to insert it in order. I am able to use PutFile and PutDatabaseRecord both for the insertion purpose. But they insert randomly in any order. I wanted it to be inserted in the same order it is present in the file.

How to do that.

1 REPLY 1

avatar
Contributor

@AlokKumar 

I am not able to understand the context here.   It would help to get to right solution if you can explain why the inserts into same table should be executed in certain order.  

However, Nifi Connection configuration settings have prioritizers.  Please check screenshot below..

If you are able to set attribute "priority" with desired number, "PriorityAttributePrioritizer" can be used.  Please note that these prioritizers operate on node level.  You may have to test these if you have multi node nifi environment. 

There is a processor "EnforceOrder" which has more options to enforce execution order.  You may check this processor and find out if it works.

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/nifi2.0-m4/org.a...

shiva239_0-1725483625036.png