How to specify query for Azure Data Factory Source (Azure Table Storage) for yesterday's records

让人想犯罪 __ 提交于 2020-03-25 18:32:41

问题


I am copying records from an Azure Storage Table (source) to Azure Storage Table (sink) everyday. So if I am executing the query on December 24th 2019 (UTC) for instance, then I want to copy records for December 23rd 2019 (UTC). The query works and is doing what I intend it to do. Here is the query:

Timestamp ge datetime'2019-12-23T00:00Z' and Timestamp lt datetime'2019-12-24T00:00Z'

In the query above, the Timestamp column is automatically stamped in the Azure Storage Table when a new record is inserted in it. That is how Azure Storage Table works.

And here is the screenshot of the Data Factory Pipeline:

I want to parameterize the query now. That is: if the query is run on 24th December, 2019 then it should copy 23rd December 2019's records and keep sliding as it executes everyday on a schedule. I don't know how to do that. I know that there is a utcNow function and there is a subtractFromTime Function. I just don't know how to put it together.


回答1:


You can do something like this:

addDays(startOfDay(utcNow()), -1)

this would find the start of the previous day

https://docs.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions#date-functions




回答2:


@4c74356b41, Thank you for your kind support. Based on your answers and some more googling, I was able to piece it together. Here is the final expression:

Timestamp ge @{concat('datetime','''',addDays(startOfDay(utcNow()), -1),'''')} and Timestamp lt @{concat('datetime','''',startOfDay(utcNow()),'''')}


来源:https://stackoverflow.com/questions/59463256/how-to-specify-query-for-azure-data-factory-source-azure-table-storage-for-yes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!