我正在使用ADF将数据从Cosmos DB复制到Azure Data Lake。我已安排它每24小时运行一次。由于ADF会将所有数据从源复制到接收器,因此我使用windowStart和windowEnd参数来过滤数据。过滤在Cosmos Document DB内的时间戳上完成。
要运行管道,我要手动指定windowStart和windowEnd UTC时间,这是不可行的。有没有办法实现自动化?我想要的是将windowStart时间设置为(预定时间 - 1天),将windowEnd时间设置为计划时间。这样我就可以获得前一天的所有数据。
生成的查询是:
select * from c
where c.data.timestamp >= '@{formatDateTime(pipeline().parameters.windowStart, 'yyyy-MM-ddTHH:mm:ssZ' )}'
AND c.data.timestamp < '@{formatDateTime(pipeline().parameters.windowEnd, 'yyyy-MM-ddTHH:mm:ssZ' )}'
如何将windowStart和windowEnd动态设置为等于-1天到预定时间?
如果您使用的是schedule trigger,请将以下值传递给您的管道。在预定时间使用adddays功能。您可以使用ADF UI来帮助您编辑/新建触发器。
"name": "trigger1",
"properties": {
"runtimeState": "Stopped",
"pipelines": [
{
"pipelineReference": {
"referenceName": "CopyPipeline_9ca",
"type": "PipelineReference"
},
"parameters": {
"windowStart": "@adddays(trigger().scheduledTime, -1)",
"windowEnd": "@trigger().scheduledTime"
}
}
],