Support Questions

Find answers, ask questions, and share your expertise

How to read a .DAT file in Nifi

avatar
Contributor

Dear Hortonworks,

How can we read a .DAT file in Nifi or transform it in CSV or JSON ? Should I create a custom processor in Java or is a possibility by reading it directly in Nifi ? Thank you !

Kind regards,
Stefan

1 ACCEPTED SOLUTION

avatar
Contributor

Hello,

It wasn't that the case. Anyway, I tried to use UpdateAttribute processor to change the filename to .CSV and it works in this way. Thank you for your time !

Kind regards,
Stefan

View solution in original post

4 REPLIES 4

avatar
Super Collaborator

I guess you need to first give some details on the format or origin of your .DAT file. There is more than just one format associated to this extension.

avatar
Contributor

We receive the .DAT files directly from the client which for the normal process that we have in place, ETL using ODI, we are open it in excel. But I wanted to know if there is a way to convert it or read it because we need to store the data of it in a table.

avatar
Super Collaborator

so it has the format of basically providing the sql statements? Like this example from Oracle?

begin
insert into ODI_STAGE.SRC_SALES_PERSON1 values
(11,'Andrew','Andersen','22/02/1999',sysdate);
insert into ODI_STAGE.SRC_SALES_PERSON1 values
(12,'John','Galagers','20/04/2000',sysdate); end;

If that's the case, you can process and transform the file with Nifi.

And here is a nice tutorial on how to achieve it using GetFile and SplitText processors:
https://community.hortonworks.com/articles/66861/nifi-etl-removing-columns-filtering-rows-changing.h...

avatar
Contributor

Hello,

It wasn't that the case. Anyway, I tried to use UpdateAttribute processor to change the filename to .CSV and it works in this way. Thank you for your time !

Kind regards,
Stefan