Reputation: 331
i want to select only few columns from .csv file in U-SQL Azure data factory.
have 10 column in my csv file I want to select only 5 columns and write into a new file
Upvotes: 1
Views: 1019
Reputation: 14379
When using the built-in extractors you have to specify all columns, but it's easy just to pick only the columns you want (also known as projection) using a rowset variable, like this:
// Do the initial extract for all columns
@input =
EXTRACT colA string,
colB string,
colC string,
colD string,
colE string,
colF string,
colG string,
colH string,
colI string,
colJ string
FROM "/input/input57.csv"
USING Extractors.Csv();
// Pick (project) the columns you need
@output =
SELECT colA,
colB,
colC,
colD,
colE
FROM @input;
// Output the columns you need
OUTPUT @output
TO "/output/output.csv"
USING Outputters.Csv();
Upvotes: 1