ADF V2错误位置不符合字符串'@'

问题描述 投票:3回答:2

这是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

知道为什么吗?

谢谢

azure azure-data-factory
2个回答
2
投票

我确实找到了问题。

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

应该像

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

0
投票

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

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

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

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

我希望这可以帮助你! :)

© www.soinside.com 2019 - 2024. All rights reserved.