You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Matt Burgess (Jira)" <ji...@apache.org> on 2022/12/23 00:32:00 UTC

[jira] [Commented] (NIFI-10996) CSV output with header - but always, even for 0 record flowfiles

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

Matt Burgess commented on NIFI-10996:
-------------------------------------

I see the issue but am still looking into it for "raw records" which do not use the schema to write the header.

> 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
>    Affects Versions: 1.19.1
>            Reporter: Josef Zahner
>            Priority: Minor
>              Labels: csv, writer
>         Attachments: NiFi_CSV_header_true.png
>
>
> 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)