Execute azure data factory foreach activity with start date and end date

半城伤御伤魂 提交于 2021-01-04 14:45:23

问题


I have a json file and it contains the start date and end date. I need to iterate over this start date and end date with azure data factory foreach activity. As per my knowledge, the foreach expect the items (collection/array). But in my case, I have only two items which are start and end date. I want to run the data factory for process some historic data. I don't have the collection of dates, so how can I iterate this with start date and end date? If someone can help me to figure it out, it would be great.


回答1:


My suggestion will be to use the UNTIL activity to iterate from start date to end date.

Like FOR-EACH, UNTIL is also used for looping in ADF. While for-each iterates over a defined collection, Until iterates till a criteria is met. This is equivalent of while loop of programming languages.

You can assign both start and end dates to a variable and use a counter variable to increment dates one by one from start to end date.

You may use AddDays expression function for incrementing a day and equals function for comparing dates




回答2:


The for-each loop has no intelligence built in to calculate the number of iterations it has to repeat for certain tasks added into the looping activity.

What can be done here is to use some sort of watermark inputs and run the data load using these watermarks. Tasks such as lookup activity will come handy to emulate this behavior.



来源:https://stackoverflow.com/questions/63448774/execute-azure-data-factory-foreach-activity-with-start-date-and-end-date

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