This is our top ask (and earlier fooobar.com/questions/1275874 / ... too :). We are currently working on it and hope that it will be available by the summer.
Before that, you need to write a script generator. I use U-SQL to generate the script, but you can do it with Powershell or T4, etc.
Here is an example:
Suppose you want to write files for the name column in the following table / rowset @x :
name | value1 | value2 -----+--------+------- A | 10 | 20 A | 11 | 21 B | 10 | 30 B | 100 | 200
You must write a script to generate the script as follows:
@x = SELECT * FROM (VALUES( "A", 10, 20), ("A", 11, 21), ("B", 10, 30), ("B", 100, 200)) AS T(name, value1, value2); // Generate the script to do partitioned output based on name column: @stmts = SELECT "OUTPUT (SELECT value1, value2 FROM @x WHERE name == \""+name+"\") TO \"/output/"+name+".csv\" USING Outputters.Csv();" AS output FROM (SELECT DISTINCT name FROM @x) AS x; OUTPUT @stmts TO "/output/genscript.usql" USING Outputters.Text(delimiter:' ', quoting:false);
Then you take genscript.usql , add the @x calculation and send it to get the data split into two files.
source share