Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

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

avatar
Expert 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
Rising Star

@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