ADF V2 Error the string character '@' at position is not expected

安稳与你 提交于 2019-12-10 19:21:01

问题


This is a double post with MSDN, but didn't get any help there so i'm hoping some expert sees it here.

I started from the example found at 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"
            }
        },

My code became

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

But i'm getting this error

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

Any idea why ?

Thx


回答1:


I did find the problem.

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

Should be used like

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



回答2:


I'm by no means an expert, but I think I can help you a bit.

Looking at the documentation https://docs.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions#string-functions I found that the concat function only applies to strings, and you are trying to concatenate a string 'bict2233/data-in/day/' with a datetime value in @{dataset().TriggerRunTime}.

Maybe you could try converting the value to a string just to be safe. You can do that using a conversion function, it would look something like this:

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

I hope this helps you! :)



来源:https://stackoverflow.com/questions/47828502/adf-v2-error-the-string-character-at-position-is-not-expected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!