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