Azure datafactory v2 Выполнить конвейер с For For Each - PullRequest
0 голосов
/ 09 апреля 2020

Я пытаюсь использовать «Выполнить конвейер», чтобы вызвать канал, который выполняет действие ForEach. Я получаю сообщение об ошибке.

  1. Json для канала Выполнить:
[
    {
        "name": "pipeline3",
        "properties": {
            "activities": [
                {
                    "name": "Test_invoke1",
                    "type": "ExecutePipeline",
                    "dependsOn": [],
                    "userProperties": [],
                    "typeProperties": {
                        "pipeline": {
                            "referenceName": "MAIN_SA_copy1",
                            "type": "PipelineReference"
                        },
                        "waitOnCompletion": true
                    }
                }
            ],
            "annotations": []
        }
    }
]
Jason for Invoke pipe для каждого действия:
[
    {
        "name": "MAIN_SA_copy1",
        "properties": {
            "activities": [
                {
                    "name": "Collect_SA_Data",
                    "type": "ForEach",
                    "dependsOn": [],
                    "userProperties": [],
                    "typeProperties": {
                        "items": {
                            "value": "@pipeline().parameters.TableNames",
                            "type": "Expression"
                        },
                        "batchCount": 15,
                        "activities": [
                            {
                                "name": "Sink_SAdata_toDL",
                                "type": "Copy",
                                "dependsOn": [],
                                "policy": {
                                    "timeout": "7.00:00:00",
                                    "retry": 0,
                                    "retryIntervalInSeconds": 30,
                                    "secureOutput": false,
                                    "secureInput": false
                                },
                                "userProperties": [
                                    {
                                        "name": "Destination",
                                        "value": "@{pipeline().parameters.DLFilePath}/@{item()}"
                                    }
                                ],
                                "typeProperties": {
                                    "source": {
                                        "type": "SqlServerSource",
                                        "sqlReaderQuery": {
                                            "value": "@concat('SELECT * FROM ',item())",
                                            "type": "Expression"
                                        }
                                    },
                                    "sink": {
                                        "type": "AzureBlobFSSink"
                                    },
                                    "enableStaging": false,
                                    "parallelCopies": 1,
                                    "dataIntegrationUnits": 4
                                },
                                "inputs": [
                                    {
                                        "referenceName": "SrcDS_StructuringAnalytics",
                                        "type": "DatasetReference"
                                    }
                                ],
                                "outputs": [
                                    {
                                        "referenceName": "ADLS",
                                        "type": "DatasetReference",
                                        "parameters": {
                                            "FilePath": "@pipeline().parameters.DLFilePath",
                                            "FileName": {
                                                "value": "@concat(item(),'.orc')",
                                                "type": "Expression"
                                            }
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                }
            ],
            "parameters": {
                "DLFilePath": {
                    "type": "string",
                    "defaultValue": "extracts/StructuringAnalytics"
                },
                "TableNames": {
                    "type": "array",
                    "defaultValue": [
                        "fom.FOMLineItem_manual"
                    ]
                }
            },
            "variables": {
                "QryTableColumn": {
                    "type": "String"
                },
                "QryTable": {
                    "type": "String"
                }
            },
            "folder": {
                "name": "StructuringAnalytics"
            },
            "annotations": []
        },
        "type": "Microsoft.DataFactory/factories/pipelines"
    }
]

Я получаю сообщение об ошибке:

[
    {
        "errorCode": "BadRequest",
        "message": "Operation on target Collect_SA_Data failed: The execution of template action 'Collect_SA_Data' failed: the result of the evaluation of 'foreach' expression '@pipeline().parameters.TableNames' is of type 'String'. The result must be a valid array.",
        "failureType": "UserError",
        "target": "Test_invoke1",
        "details": ""
    }
]

Ввод:

"pipeline": {
    "referenceName": "MAIN_SA_copy1",
    "type": "PipelineReference"
},
"waitOnCompletion": true,
"parameters": {
    "DLFilePath": "extracts/StructuringAnalytics",
    "TableNames": "[\"fom.FOMLineItem_manual\"]"
}

1 Ответ

0 голосов
/ 09 апреля 2020

Пожалуйста, попробуйте обновить динамическое выражение c ForEach Items, как показано ниже:

{
    "value": "@array(pipeline().parameters.TableNames)",
    "type": "Expression"
}

enter image description here

Надеюсь, это поможет.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...