usql icon indicating copy to clipboard operation
usql copied to clipboard

How dynamically create multiple output files from 1 or more input files?

Open almusawi opened this issue 7 years ago • 2 comments

is it possible to create dynamically output files depend on the date? For example:

DECLARE @output_Path string = @"/Folder/_{_Date:yyyy}{_Date:MM}out.tsv"; @ex = EXTRACT ID int, EventTime string FROM @IN USING Extractors.text()

@res = SELECT ID, DateTime.Parse(EventTime) AS _Date FROM @ex

OUTPUT @res TO @output_Path USING Outputters.csv()

almusawi avatar Apr 16 '18 08:04 almusawi

Yes... although this feature is in Private Preview at the moment. Can you send me an email to usql at microsoft dot com with a description of your scenario? I can give you the explanation on how to enable the private preview capability for it.

MikeRys avatar Apr 16 '18 17:04 MikeRys

I have a same scenario. I have one input file I have to spilt that input file to multiple output based on column value. Say Input file has column country,product,sales and I have to generated outputfile based on countryname.

country,product,sales US,WIN10,12 US,O365,13 UK,Book,12 INDIA,mobile,14 based on the above input, I want 3 output file UK_produc.csv,US_product.csv and India_product.csv.

Could you please help

RamPatel58 avatar Jul 11 '19 10:07 RamPatel58