Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

Solved Go to solution

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

New 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

Accepted Solutions

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

Master Guru
@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

3 REPLIES 3

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

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

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

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.

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

Master Guru
@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