【问题标题】:Use date parameter in Azure Pipeline FetchXML query在 Azure Pipeline FetchXML 查询中使用日期参数
【发布时间】:2023-01-11 06:01:14
【问题描述】:

在我的 Azure 数据工厂管道中,我有一个参数,我们称它为“日期',它的默认值为2023-01-01.

但是每次运行管道(复制数据)时,我都希望能够更改它。

我可以用一个变量来做到这一点,如下所示(日期 1变量),但我必须更改变量的值。

我怎么能在这里插入一个参数呢?

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"> 
<entity name="my_attachment"> 
<all-attributes/>  
<filter type="and"> 
<condition attribute="createdon" operator="on-or-after" value="@{variables('date1')}" /> 
</filter>  
</entity> 
</fetch>

【问题讨论】:

    标签: azure parameters azure-data-factory fetchxml


    【解决方案1】:
    • 参数在特定管道中是常量。因此,您无法在管道内更改其值。
    • 具有静态值的变量(比如2023-01-01)本身就是一个参数。每次执行管道时,相同的值将分配给变量,使其功能类似于参数。
    • 如果您的日期有一个模式,例如在 10 天或之前(从今天开始)创建,那么您可以为此值构建一个动态管道表达式。因此,每次运行管道时,该值都会根据需要动态变化。
    • 如果没有这样的模式,那么你必须使用参数。您仍然可以在每次运行管道时更改该值。
    • 当您尝试触发或调试管道时,pipeline run 选项卡将提示您输入参数值。您可以简单地提供所需的值并相应地进行。
    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
    <entity name="my_attachment">
    <all-attributes/>
    <filter type="and">
    <condition attribute="createdon" operator="on-or-after" value="@{pipeline().parameters.req_date}" />
    </filter>
    </entity>
    </fetch>
    

    【讨论】:

    • 非常感谢您的帮助。
    猜你喜欢
    • 2011-12-28
    • 2021-01-23
    • 2022-09-27
    • 1970-01-01
    • 2020-08-28
    • 2013-03-09
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    相关资源
    最近更新 更多