【问题标题】:Azure Data Factory: StartDate in Default ParametersAzure 数据工厂:默认参数中的 StartDate
【发布时间】:2018-12-15 05:54:18
【问题描述】:

我正在尝试为 startDate 参数指定一个默认值,如下所示:

我一直在检查如何用函数指定 so,但到目前为止我还没有找到任何东西。

到目前为止,我为 startDate 指定了一个手动值,但其想法是在每次计划运行时获取当前日期。

我在 blob 存储目标(正在使用它的地方)中定义了这个:

@{formatDateTime(pipeline().parameters.windowStart,'yyyy')}@{formatDateTime(pipeline().parameters.windowStart,'MM')}@{formatDateTime(pipeline().parameters.windowStart,'dd')}@{formatDateTime(pipeline().parameters.windowStart,'HH')}@{formatDateTime(pipeline().parameters.windowStart,'mm' 

有没有办法代替调用参数直接使用 utcnow() ?

【问题讨论】:

    标签: azure azure-blob-storage azure-data-factory-2


    【解决方案1】:

    你可以使用utcnow()函数, 或者如果你要定义触发器,你可以使用trigger().startTime。 其他日期函数你可以找到here

    【讨论】:

    • 我试试
    • 我对此非常迷茫,我尝试过这种方式: trigger().startTime.utcnow() 并且出现以下错误; Activity CopyProd failed: 'In function 'formatDateTime', the value provided for date time string 'trigger().startTime.utcnow()' was not valid. The datetime string must match ISO 8601 format.'.
    【解决方案2】:

    formatDateTime 函数用于返回特定日期格式的字符串。 如果没有为您导入格式,而您只需要当前日期,那么您可以在表达式字段中使用trigger().startTimeutcnow()。不要忘记@符号。

    trigger().startTime.utcnow 不是有效的表达式。

    【讨论】:

      【解决方案3】:

      最后我能够通过使用如下所示的 JSON 代码创建触发器来解决此问题:

      {
          "name": "yourTriggerName",
          "properties": {
              "runtimeState": "Started",
              "pipelines": [
                  {
                      "pipelineReference": {
                          "referenceName": "YourPipelineName",
                          "type": "PipelineReference"
                      },
                      "parameters": {
                          "windowStart": "@trigger().scheduledTime"
                      }
                  }
              ],
              "type": "ScheduleTrigger",
              "typeProperties": {
                  "recurrence": {
                      "frequency": "Day",
                      "interval": 1,
                      "startTime": "2018-07-11T17:00:00Z",
                      "timeZone": "UTC",
                      "schedule": {
                          "minutes": [
                              20
                          ],
                          "hours": [
                              19
                          ]
                      }
                  }
              }
          }
      }
      And making emphasis of course, in line below:
      
      "parameters": {
                              "windowStart": "@trigger().scheduledTime"
      

      之后,复制活动开始按预期工作。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-02-15
        • 2022-09-29
        • 2017-08-21
        • 2015-02-21
        • 2019-07-03
        相关资源
        最近更新 更多