繁体   English   中英

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

[英]Azure Data Factory Pipeline to copy multiple tables fails

我的第一篇文章,如果我做错了什么,请提前道歉

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

这里

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

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"
                    ]
                }
            ]
        }
    ]
}
}

感谢大家的评论。

问题出在 (GetTableListAndTriggerCopyData)

"value": "@array(activity('LookupTableList').output.value)", 错了,正确的语法是: "value": "@activity('LookupTableList').output.value)",

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM