简体   繁体   English

添加动态内容 - Azure 数据工厂 ADF

[英]Add Dynamic Content - Azure Data Factory ADF

I need to add a Dynamic Content in an ADF.我需要在 ADF 中添加动态内容。 In such a way that it needs to get last month date as below formate.以这样的方式,它需要获得如下格式的上个月日期。

Result: 2018-12.csv.zip结果:2018-12.csv.zip

If you set the date to the 28th and then subtract 30 days, that should get you into the previous month from any date.如果您将日期设置为 28 日,然后减去 30 天,那么您应该可以从任何日期进入上个月。 Then simply format as yyyy-MM , eg然后简单地格式化为yyyy-MM ,例如

@concat(formatDateTime(adddays(formatDateTime(utcnow(), 'yyyy-MM-28'),-30),'yyyy-MM'),'.csv.zip')

This can be done by using https://docs.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions .这可以通过使用https://docs.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions来完成。

Possible solution: I will suggest you to use 3 parameters here.可能的解决方案:我建议您在这里使用 3 个参数。 This solution use trigger().startTime, but you can use utcnow() aswell.此解决方案使用 trigger().startTime,但您也可以使用 utcnow()。

Note: adddays(trigger().startTime,-31,'MM') will return 12 as month, as that month was 31 days ago.注意: adddays(trigger().startTime,-31,'MM') 将返回 12 作为月份,因为该月份是 31 天前。 If your trigger is on 5th of the month, or on the first day in the month than you can use -2.如果您的触发器是在当月的 5 号或当月的第一天,那么您可以使用 -2。

processYear = @formatDateTime(adddays(trigger().startTime,-31), 'yyyy')

processMonth = @formatDateTime(adddays(trigger().startTime,-31), 'MM')

result = @concat(pipeline().parameters.processYear,'-',pipeline().parameters.processMonth,'.csv.zip').

Hope that this helps.希望这会有所帮助。

@concat(formatDateTime(subtractFromTime(utcNow(),1,'Month'), 'yyyy-MM'), '.csv.zip')

Above given case works, if I know the date but I am running my Data Factory every day.如果我知道日期但我每天都在运行我的数据工厂,那么上面给出的案例是有效的。 So below works better.所以下面效果更好。

@concat(substring(string(if(equals(int(formatDateTime(utcnow(), 'MM')),01), sub(int(formatDateTime(utcnow(), 'yyyyMM')),89),sub(int(formatDateTime(utcnow(),'yyyyMM')),1))),0,4),'-',substring(string(if(equals(int(formatDateTime(utcnow(), 'MM')),01), sub(int(formatDateTime(utcnow(), 'yyyyMM')),89),sub(int(formatDateTime(utcnow(),'yyyyMM')),1))),4,2),'.csv.zip') @concat(substring(string(if(equals(int(formatDateTime(utcnow(), 'MM')),01), sub(int(formatDateTime(utcnow(), 'yyyyMM')),89),sub(int (formatDateTime(utcnow(),'yyyyMM')),1))),0,4),'-',substring(string(if(equals(int(formatDateTime(utcnow(), 'MM')),01 ), sub(int(formatDateTime(utcnow(), 'yyyyMM')),89),sub(int(formatDateTime(utcnow(),'yyyyMM'))),1))),4,2),'.csv 。压缩')

Any changes appreciated.任何更改表示赞赏。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 添加动态内容-Azure数据工厂ADF V2 - Add Dynamic Content - Azure Data Factory ADF V2 为 Azure 数据工厂中的注释添加动态内容 - Add dynamic content to annotations in Azure Data Factory Azure 数据工厂 - 将参数添加到链接到 Git 存储库的 ADF - Azure Data Factory - Add parameter to ADF linked to Git repo Azure Data Factory V2 - 无法将通配符文件名与动态内容文件路径组合在一起。 是否有数据库(ADB)解决方案或其他ADF解决方案? - Azure Data Factory V2 - Cannot combine wildcard filenames with dynamic content filepath. Is there a databricks (ADB) solution or another ADF solution? Azure数据工厂V2动态内容 - Azure Data Factory V2 Dynamic Content Azure 数据工厂动态内容参数 - Azure Data Factory Dynamic content parameter JSON 的 Azure 数据工厂 ADF 架构验证 - Azure Data Factory ADF Schema validation for JSON Azure 数据工厂 - 尝试将参数添加到 REST API 请求正文中的动态内容 - Azure Data Factory - attempting to add params to dynamic content in the body of a REST API request Azure 数据工厂在动态内容字段中添加具有 JSONPath 表达式值的逻辑运算符 - Azure Data Factory add logical operators with JSONPath expression values in dynamic content field 如何将动态内容添加到 Azure 数据工厂数据集中的“第一行作为标题”条件? - How can I add dynamic content to “First Row As Header” condition in Azure Data Factory Dataset?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM