Support Questions

Find answers, ask questions, and share your expertise

reading csv file with nifi

avatar
Contributor

hi guys! I have the following task to do using NIFI - I have a csv file which has columns: first name, last name, date of birth, address, phone, mail. I need to read this file record by record and extract the first name, last name and date of birth from each record to use later to create a rest query. What processors are best to use for this task?

 

1 REPLY 1

avatar

@MWM,

If you want to read line by line (record by record), you should use SplitRecord to split the CSV record by record and send them further into processing. You will define and RecordReader - CSV in your case and a RecordWriter - JSON. Next, using EvaluateJsonPath, you can extract the content of each FlowFile and add them as attributes. Lastly, you can send those attributes to create the rest query.

But please take note that if you are working with CSVs containing far too many lines, you will have some performance issues and you might want to rethink your option.

PS: there are other options to perform the task so you can wait for other responses and choose the best one for you 🙂