Skip to content

Instantly share code, notes, and snippets.

/test.usql Secret

Created December 29, 2017 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1ce1cec2716d47bbfadd993b77821b2f to your computer and use it in GitHub Desktop.
Save anonymous/1ce1cec2716d47bbfadd993b77821b2f to your computer and use it in GitHub Desktop.
DECLARE @file_set_path string = "/Data/SomeEntity/{date:yyyy}/{date:MM}/{date:dd}/SomeEntity_{date:yyyy}_{date:MM}_{date:dd}__{date:H}/test.csv";
// The "H" custom format specifier represents the hour as a number from 0 through 23;
@input =
EXTRACT [Id] long,
date DateTime
FROM @file_set_path
USING Extractors.Csv();
@rdate =
SELECT MAX(ProcessedDate) AS maxDate
FROM dbo.SyncTable;
@output =
SELECT *,
date.ToString() AS dateString
FROM @input AS i
CROSS JOIN
@rdate AS r
WHERE i.date >= r.maxDate;
OUTPUT @output TO "/output/output.csv"
ORDER BY Id
USING Outputters.Csv(quoting:false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment