复制多个表的Azure数据工厂管道失败

时间:2020-03-20 10:40:57

标签: database azure azure-pipelines azure-data-factory

我的第一篇文章,如果我做错了事,对不起!

我已按照下面的Microsoft文档中的说明进行操作,并创建了一个数据工厂,以将多个表的数据从本地数据库复制到Azure数据库。

here

管道失败,出现以下错误:

PipelineName      : GetTableListAndTriggerCopyData
LastUpdated       : 3/20/2020 10:16:42 AM
Parameters        : {}
RunStart          : 3/20/2020 10:16:10 AM
RunEnd            : 3/20/2020 10:16:42 AM
DurationInMs      : 32430
Status            : Failed
Message           : Operation on target TriggerCopy failed:Operation on target IterateSQLTables failed: Activity failed because an inner activity failed

两个管道的Json数据如下:

第一个管道IterateAndCopySQLTables

{
"name": "IterateAndCopySQLTables",
"properties": {
    "activities": [
        {
            "name": "IterateSQLTables",
            "type": "ForEach",
            "typeProperties": {
                "isSequential": "false",
                "items": {
                    "value": "@pipeline().parameters.tableList",
                    "type": "Expression"
                },
                "activities": [
                    {
                        "name": "CopyData",
                        "description": "Copy data from On Prem SQL database to Azure SQL database",
                        "type": "Copy",
                        "inputs": [
                            {
                                "referenceName": "OnPremSourceDataset",
                                "type": "DatasetReference"
                            }
                        ],
                        "outputs": [
                            {
                                "referenceName": "AzureSinkDataset",
                                "type": "DatasetReference",
                                "parameters": {
                                    "SinkTableName": "[@{item().TABLE_NAME}]"
                                }
                            }
                        ],
                        "typeProperties": {
                            "source": {
                                "type": "SqlSource",
                                "sqlReaderQuery": "SELECT * FROM dbo.[@{item().TABLE_NAME}]"
                            },
                            "sink": {
                                "type": "AzureSqlSink",
                                "preCopyScript": "TRUNCATE TABLE dbo.[@{item().TABLE_NAME}]"
                            }

                        }
                    }
                ]
            }
        }
    ],
    "parameters": {
        "tableList": {
            "type": "Array"
        }
    }
}
}

第二个管道:GetTableListAndTriggerCopyData

{
"name":"GetTableListAndTriggerCopyData",
"properties":{
    "activities":[
        { 
            "name": "LookupTableList",
            "description": "Retrieve the table list from On Prem SQL database",
            "type": "Lookup",
            "typeProperties": {
                "source": {
                    "type": "SqlSource",
                    "sqlReaderQuery": "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'dbo' and TABLE_NAME in ('Brd','Loc')"
                },
                "dataset": {
                    "referenceName": "OnPremSourceDataset",
                    "type": "DatasetReference"
                },
                "firstRowOnly": false
            }
        },
        {
            "name": "TriggerCopy",
            "type": "ExecutePipeline",
            "typeProperties": {
                "parameters": {
                    "tableList": {
                        "value": "@array(activity('LookupTableList').output.value)",
                        "type": "Expression"
                    }
                },
                "pipeline": {
                    "referenceName": "IterateAndCopySQLTables",
                    "type": "PipelineReference"
                },
                "waitOnCompletion": true
            },
            "dependsOn": [
                {
                    "activity": "LookupTableList",
                    "dependencyConditions": [
                        "Succeeded"
                    ]
                }
            ]
        }
    ]
}
}

1 个答案:

答案 0 :(得分:0)

非常感谢您的评论。

问题出在(GetTableListAndTriggerCopyData)

“ value”:“ @array(activity('LookupTableList')。output.value)”, 是错误的,正确的语法是: “ value”:“ @activity('LookupTableList')。output.value)”,