Support Questions

Find answers, ask questions, and share your expertise

What is the best way to load a csv file into DB using NiFi?

avatar
New Contributor

I have a requirement to process a csv file into Teradata. I came up with a design but I would like to know if there is a better way to do this.

My design : SplitText --> ExtractText-->ReplaceText-->PutSQL

I do not think this approach is efficient if we have a lot of records in a csv file. I am looking for a design that can do batch inserts into the DB. Thanks.

3 REPLIES 3

avatar
Guru

Hi @Abhilash Dasari

The PutDatabaseRecord processor using a CSV Record Reader looks to be a possible solution:

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.7.1/org.apache...

avatar
New Contributor

@Andrew Lim: Thank you for your response. Looks like the PutDatabaseRecord processor needs a lot of configuration to be done. I will try it out and update the thread on the outcome.

avatar
Guru

No problem @Abhilash Dasari, hope you are successful in getting PutDatabaseRecord working.

Some PutDatabaseRecord examples in HCC (MySQL database not Teradata):

https://community.hortonworks.com/articles/113941/change-data-capture-cdc-with-apache-nifi-version-1...

https://community.hortonworks.com/questions/174129/loading-a-simple-csv-file-using-nifiputdatabasere...

Lastly, the UI in HCC isn't helpful in promoting this, but to keep these question/answer threads cleaner, it is a good practice to select "Add comment" instead of creating a new "Answer" when replying. Thanks!