01-08-2021 02:21 PM
I am looking for solution on how to write an empty data with headers csv file. I have a Oracle snap that execute a query then output to a csv file. I still want the csv file to be produced even the query returns zero record.
Here is my pipeline
01-08-2021 06:17 PM
See Empty CSV File With Header Row
01-20-2021 02:45 PM
I am coming back here to share my simple solution how to write an empty CSV file when there is no data in the stream source (SQL or Oracle)
First, you need to do a COUNT query from your database. Then add a router, if COUNT is not equal zero, then do your thing, if COUNT is zero, then add a file Reader to read your empty CSV file that you put in your file directory, then write the file to your destination
So here is my entire pipeline
Then first snap is count
Then Router Snap
Then File Reader to read my empty CSV file with headers
Then finally, write that empty CSV file to destination
Hope that helps