簡體   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