none
Prevent writing empty files

    Question

  • In a USQL script is there a way to prevent writing files with just a header row?  If the resultset does not contain any rows, we would like to prevent writing a file in the outputter command.  Having a file present may provide a false input dependency to Azure Data Factory.

    Currently statement below writes a file with just a header row if the @out resultset doesn't contain any rows.  

    OUTPUT @out TO @outputlocation USING Outputters.Tsv(outputHeader : true, quoting : false);

        


    Andrew Sears, T4G Limited, http://www.performancepointing.com

    Monday, November 28, 2016 11:12 PM

Answers

All replies

  • At this point you will always write a possibly empty file with an OUTPUT statement.

    I suggest that you request a feature to not generate a file on an empty rowset.


    Michael Rys

    Wednesday, November 30, 2016 12:03 AM
    Moderator
  • Thanks Michael.  I found that by throwing an exception from an inline function / code behind prevents writing files.

    I have also requested a feature for this.

    cheers,

    Andrew


    Andrew Sears

    Sunday, December 11, 2016 10:18 PM