I am having a pipeline be run on GCP Dataflow where I read from an SQL instance and collect the data in a PCollection and then write that PCollection to a CSV file. It seems that while writing to CSV I cannot pass the header at Runtime (as a valueprovider) as given here the header has to be a string argument.
I have tried giving an empty string and updating the string in runtime, but it doesn't work. I take the first empty string as header only.
Is there any way that I can generate the header inside and have that string as header or if I can pass the header as a runtime argument?
Attaching the textio code below
String header = /*header*/;
PCollection<String> output = /*jdbc result*/;
output
.apply(
"Write File(s)",
TextIO.write()
.to(options.getFilePath())
.withSuffix(".csv")
.withHeader(header)
.withShardNameTemplate("-S-of-N")
.withTempDirectory(options.getTempDirectory()))