azure-data-lakeu-sql

get existing file and append data into an existing file -- U-SQL


How can we get an existing file and append data into that file through u-sql script.

`DECLARE @file1 string = "dailyfiles/daily/LATESTMODIFIEDFILENAME.csv";

DECLARE @out string = "/output/result.csv";

@data = EXTRACT col1 string, col2 string, col3 string, col4 string FROM @file1,@file2 USING Extractors.Csv();

APPEND DATA INTO AN EXISTING FILE CODE`


Solution

  • I have the same problem some days ago. Is an workaround but really helps me in my implementation.

    I follow the same logic of unions of data to get the final result with updated values:

    https://www.purplefrogsystems.com/paul/2016/12/writing-a-u-sql-merge-statement/

    Hope this help you!