ADF V2 เกิดข้อผิดพลาด ไม่คาดว่าจะมีอักขระสตริง '@' ที่ตำแหน่ง

นี่เป็นการโพสต์สองครั้งกับ MSDN แต่ไม่ได้รับความช่วยเหลือใด ๆ ดังนั้นฉันหวังว่าผู้เชี่ยวชาญบางคนจะเห็นมันที่นี่

ฉันเริ่มจากตัวอย่างที่พบใน https://docs.microsoft.com/en-us/azure/data-factory/tutorial-increational-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

มีความคิดว่าทำไม?

ขอบคุณ


person Harry Leboeuf    schedule 15.12.2017    source แหล่งที่มา
comment
คุณลองทำตามด้านล่างแล้วดูว่าได้ผลหรือไม่ - "folderPath": "@CONCAT('bict2233/data-in/day/', dataset().TriggerRunTime)"   -  person Abhishek    schedule 19.12.2017


คำตอบ (2)


ฉันพบปัญหาแล้ว

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

ควรใช้แบบ

"folderPath": {
"value": "@concat('bict2233/data-in/day/', formatDateTime(dataset().TriggerRunTime,'yyyyMMddHH'))",
"type": "Expression"
}
person Harry Leboeuf    schedule 20.12.2017
comment
ขอบคุณ สิ่งสำคัญมากที่ต้องทราบว่าภายในฟังก์ชันวันที่ formatDateTime คุณไม่สามารถใช้ @ ได้ เช่น @dataset().TriggerRunTime.... นี่คือปัญหาของฉัน - person dim_user; 17.08.2018

ฉันไม่ได้เป็นผู้เชี่ยวชาญเลย แต่ฉันคิดว่าสามารถช่วยคุณได้นิดหน่อย

ดูเอกสารประกอบ https://docs.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions#string-functions ฉันพบว่าฟังก์ชัน concat ใช้กับสตริงเท่านั้น และคุณ กำลังพยายามเชื่อมสตริง 'bict2233/data-in/day/' ด้วยค่า datetime ใน @{dataset().TriggerRunTime}

บางทีคุณอาจลองแปลงค่าเป็นสตริงเพื่อความปลอดภัย คุณสามารถทำได้โดยใช้ฟังก์ชันการแปลง ซึ่งจะมีลักษณะดังนี้:

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

ฉันหวังว่านี่จะช่วยคุณได้! :)

person Martin Esteban Zurita    schedule 19.12.2017