- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Nifi - AVRO to CSV or Json to CSV,NIFI - convert Avro to CSV
- Labels:
-
Apache NiFi
Created on 07-07-2016 09:15 PM - edited 09-16-2022 03:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am unable to find a processor which can convert Avro to CSV or Json to CSV .. any pointer on this ..
,
I am working on a data flow, where I am reading data from Redshift and then pushing data to a .csv file. All is good, however I am unable to find a processor which can convert data to CSV format.
Created 07-08-2016 05:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Faisal Hussain please take a look at this post.
@Bryan Bende mentioned this:
incoming CSV like:
h1,h2,h3,h4
v1,v2,v3,v4
You could capture that in ExtractText with a pattern of:
(.+),(.+),(.+),(.+)\n(.+),(.+),(.+),(.+)
Then in ReplaceText:
{ "${csv.1}" : "${csv.5}", "${csv.2}" : "${csv.6}", "${csv.3}" : "${csv.7}", "${csv.4}" : "${csv.8}" }
Would produce:
{ "h1" : "v1", "h2" : "v2", "h3" : "v3", "h4" : "v4" }
Created 07-08-2016 05:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Faisal Hussain please take a look at this post.
@Bryan Bende mentioned this:
incoming CSV like:
h1,h2,h3,h4
v1,v2,v3,v4
You could capture that in ExtractText with a pattern of:
(.+),(.+),(.+),(.+)\n(.+),(.+),(.+),(.+)
Then in ReplaceText:
{ "${csv.1}" : "${csv.5}", "${csv.2}" : "${csv.6}", "${csv.3}" : "${csv.7}", "${csv.4}" : "${csv.8}" }
Would produce:
{ "h1" : "v1", "h2" : "v2", "h3" : "v3", "h4" : "v4" }
Created 07-08-2016 05:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created 07-08-2016 05:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Faisal Hussain I do not think there is one but definitely there is plan to develop one.
https://cwiki.apache.org/confluence/display/NIFI/First-class+Avro+Support
You can convert Avro to JSON (ConvertAvroToJSON) and then call a script (lots of example of scripts in the internet for converting JSON to csv using java/javascript/perl/bash/awk etc and etc) in the ExecuteStreamCommand processor. This would work. Let us know if you need more details.
