【问题标题】:ADF V2 Error the string character '@' at position is not expectedADF V2 错误字符串字符'@'在位置不是预期的
【发布时间】:2017-12-15 08:33:36
【问题描述】:

这是与 MSDN 的双重帖子,但在那里没有得到任何帮助,所以我希望一些专家在这里看到它。

我从https://docs.microsoft.com/en-us/azure/data-factory/tutorial-incremental-copy-powershell的示例开始

"name": "SinkDataset",
    "properties": {
        "type": "AzureBlob",
        "typeProperties": {
            "folderPath": "adftutorial/incrementalcopy",
            "fileName": "@CONCAT('Incremental-', pipeline().RunId, '.txt')", 
            "format": {
                "type": "TextFormat"
            }
        },

我的代码变成了

"typeProperties": {
            "fileName": "S1073_PBI_DAY_JUSTIF_VW.csv",
            "folderPath": "@CONCAT('bict2233/data-in/day/', @{dataset().TriggerRunTime})",
            "format": {
                "type": "TextFormat",
....

但是我收到了这个错误

Invoke-AzureRmDataFactoryV2Pipeline : HTTP Status Code: BadRequest
Error Code: BadRequest
Error Message: The template validation failed: 'the string character '@' at position '32' is not expected..'.
Request Id: 55664c55-8a20-403b-9fbf-a4c24166b473
Timestamp (Utc):12/14/2017 15:37:59
At C:\ADF\bict2233_A\Powershell\T.ps1:25 char:10
+ $runId = Invoke-AzureRmDataFactoryV2Pipeline -PipelineName "lstgDayJu ...
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Invoke-AzureRmDataFactoryV2Pipeline], ErrorResponseExceptio

知道为什么吗?

谢谢

【问题讨论】:

  • 您是否尝试过如下方法并检查是否成功 - "folderPath": "@CONCAT('bict2233/data-in/day/', dataset().TriggerRunTime)"

标签: azure azure-data-factory


【解决方案1】:

我确实找到了问题。

"folderPath": "@concat('bict2233/data-in/day/', formatDateTime(dataset().TriggerRunTime,'yyyyMMddHH'))"

应该像这样使用

"folderPath": {
"value": "@concat('bict2233/data-in/day/', formatDateTime(dataset().TriggerRunTime,'yyyyMMddHH'))",
"type": "Expression"
}

【讨论】:

  • 谢谢,非常重要的是要注意在 formatDateTime 日期函数中不能使用 @,例如 @dataset().TriggerRunTime....这是我的问题
【解决方案2】:

我绝不是专家,但我想我可以帮助你一点。

查看文档https://docs.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions#string-functions 我发现 concat 函数仅适用于字符串,并且您试图将字符串 'bict2233/data-in/day/' 与@{dataset() 中的日期时间值连接起来。触发运行时间}。

为了安全起见,也许您可​​以尝试将值转换为字符串。您可以使用转换函数来做到这一点,它看起来像这样:

            "folderPath": "@CONCAT('bict2233/data-in/day/', @string(@{dataset().TriggerRunTime}))"

希望对您有所帮助! :)

【讨论】:

    猜你喜欢
    • 2017-05-21
    • 1970-01-01
    • 1970-01-01
    • 2018-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多