Support Questions

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

NiFi - ConvertCSVtoAVRO (without inferring schema) - how to rename the output file?

avatar
Contributor

Hi,

I am using ConvertCSVtoAVRO transformation in NiFi to obtain an avro file (from local to local address) with a predefined schema.

All the records successfully go through, however I cannot find a place in PutFile block (connected direclty to ConvertCSVtoAVRO) where I can change the filename.

Does anyone know how to do it?

Let's assume I have input.csv and want to obtain output.avro file.

Thanks, Michal

1 ACCEPTED SOLUTION

avatar
Super Mentor
@Michal R

You can use an UpdateAttribute processor to change the filename.

11550-screen-shot-2017-01-20-at-100136-am.png

However, this would end up with every file having the same filename.

Assuming each input filename is unique excpet has a .csv extension, you could do the following:

11561-screen-shot-2017-01-20-at-100352-am.png

This would essentially replace the .csv extension with .avro while leaving the rest of the original filename unchanged.

Thanks,

Matt

View solution in original post

3 REPLIES 3

avatar
Master Guru

You can use an UpdateAttribute processor and change the 'filename' attribute.

avatar

Hi @Michal R,

What you are looking for can be achieved with an UpdateAttribute processor, and you just need to update the 'filename' attribute, this is the attribute used by the PutFile processor.

Hope this helps.

avatar
Super Mentor
@Michal R

You can use an UpdateAttribute processor to change the filename.

11550-screen-shot-2017-01-20-at-100136-am.png

However, this would end up with every file having the same filename.

Assuming each input filename is unique excpet has a .csv extension, you could do the following:

11561-screen-shot-2017-01-20-at-100352-am.png

This would essentially replace the .csv extension with .avro while leaving the rest of the original filename unchanged.

Thanks,

Matt