[ 
https://issues.apache.org/jira/browse/NIFI-10996?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17675630#comment-17675630
 ] 

ASF subversion and git services commented on NIFI-10996:
--------------------------------------------------------

Commit a9baa21f87eac5f2992c42ea4a45af00a3f19af6 in nifi's branch 
refs/heads/main from Matt Burgess
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=a9baa21f87 ]

NIFI-10996: Write out CSV header even if there are no records

This closes #6818

Signed-off-by: Mike Thomsen <[email protected]>


> CSV output with header - but always, even for 0 record flowfiles
> ----------------------------------------------------------------
>
>                 Key: NIFI-10996
>                 URL: https://issues.apache.org/jira/browse/NIFI-10996
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>            Reporter: Josef Zahner
>            Assignee: Matt Burgess
>            Priority: Minor
>              Labels: csv, writer
>         Attachments: NiFi_CSV_header_true.png
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> We use a “ConvertRecord” processor where we convert an AVRO to a CSV. For 
> that *CSV* output we would like to have the {*}header enabled{*}, so we tried 
> to set “{{{}Include Header Line – true{}}}” for the Controller Service of the 
> CSVRecordSetWriter. The issue is, *if we have zero records, the header 
> doesn’t show up* (but it was there of course in the AVRO file). We need to 
> have it as the columns are important for us, even if we have 0 records.
> At the moment we solve it with an extra ExecuteScript processor just before 
> the ConvertRecord, there we add always an extra record with the header lines 
> as string. But it feels a bit hacky as the record.count attribute is 1 record 
> too high (due to the fake header record).
> !NiFi_CSV_header_true.png!
> Comment from [~joewitt] from users mailinglist: _"Makes sense what you're 
> looking for.  Just not sure where this 'concern' would live whether it is in 
> the processors themselves or the controller services for the writers."_
> It seems that I'm not alone with that requirement, at least one other person 
> (Jens M. Kofoed) uses a similar workaround.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to