I have a pipeline that daily extracts newly updated data from an SQLDB table into a .tsv file in Data Lake Store.
That data will be used later to append/update to an existing table.
To select only the newly updated rows from SQLDB, I used a sqlReaderQuery to select from a table with a WHERE clause ("WHERE DATEDIFF(day,c.UpdatedOn,GETDATE())=1") at the end which allows me to select only rows that have been updated (c.UpdatedOn) one day before the execution of the pipeline.
The problem is: Imagine that the pipeline is paused for 1 week for maintenance. Then, when I resume the pipeline, it will only retrieve the rows added in the last day of the previous week...
Is there any way I can use a system variable that indicates the last time the pipeline ran?
So I could replace the GETDATE() in the WHERE clause for the system variable, for example:
WHERE DATEDIFF(day,c.UpdatedOn,DateOfPipelineLastExecution)<0
Thank you