Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

In Apache Nifi not able to get csv file from my database

avatar
Explorer

file i am receiving.file i am receiving.I am encountering the same issue. I attempted the method you suggested, but it didn't work. I'm trying to copy a table from my MySQL database to my local machine using Apache NiFi. I've configured the 'ConvertRecord' processor and added the 'CSVRecordSetWriter', but I'm still receiving files in JSON format. Can you please guide me if I'm making any mistakes?Screenshot (27).pngScreenshot (28).png

6 REPLIES 6

avatar
Community Manager

@sajidkhan Welcome to the Cloudera Community!

To help you get the best possible solution, I have tagged our NiFi experts @steven-matison @MattWho  who may be able to assist you furth

Please keep us updated on your post, and we hope you find a satisfactory solution to your query.


Regards,

Diana Torres,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:

avatar
Explorer

Thanks @DianaTorres  I will wait. hope it they will provide some solution shortly.

avatar
Super Guru

Hi @sajidkhan ,

Have you actually ran the flowfiles through the ConvertRecord processor? I noticed you have 8 files queued in the ExecuteSQL success relationship. If you open the flowfiles to inspect from there they are going to be in AVRO format since ExecuteSQL will produce such format by defualt. You have to right click the ConvertRecord Processor and select Start to get the files processed through (Keep the Put File processor Stopped)  and then under the ConvertRecord success relationship you should have 8 converted flowfiles that you can inspect to see if they got converted to CSV. If the conversion was done accordingly then you can start the PutFile processor to save them to your local drive.

Since you seem to be new to Nifi, I would recommend referring to the following article to understand how Nifi and Nifi processors  work:

https://docs.cloudera.com/cfm/2.0.4/nifi-user-guide/topics/nifi-processor_anatomy.html

https://nifi.apache.org/docs/nifi-docs/html/nifi-in-depth.html

https://nifi.apache.org/docs/nifi-docs/html/user-guide.html

https://nifi.apache.org/docs/nifi-docs/html/overview.html

 

If you find this is helpful please accept solution.

Thanks

 

 

avatar
Explorer

Hi @SAMSAL actually i just stopped the all processors thats why showing 8 file in Queued. but previously when i was running all processor it was giving me files in my local folder using putfileprocessor, but the issue is the file i am getting in not in csv formate i already show that in the first screenshort, however i use convert record processor.

avatar
Expert Contributor

HI @sajidkhan,

I have tried below and seems records are getting successfully converted to csv. 

option 1: As samsal suggest we can use the ConvertRecord to convert to specific file format.

option2: just try using the updaterecord processor and add some dummy calculation on it.

saquibsk_0-1712025896996.pngsaquibsk_1-1712025918978.png

Output

saquibsk_2-1712025959046.png

 

Shakib M.

avatar
Community Manager

@sajidkhan Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future.  Thanks.


Regards,

Diana Torres,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: