Azure数据工厂-将数据导出到子容器/ blob

时间:2019-11-27 23:01:22

标签: azure

嗨,我有一个ADF,可将CSV文件复制(导出Azure SQL数据)到Blob。 如何将文件定向到-“子”容器

我有一个名为“ SQLdata”的Blob,我希望在称为“客户”的子容器/ blob中创建文件

  • SQLdata /客户

    SQLdata / Customers / Cust1.csv

    SQLdata / Customers / Cust2.csv

我尝试过

 "destination": {
                            "fileName": "Customers//Cust1.csv"

以下内容有什么问题?

   "activities": [
                    {
                        "name": "Export",
                        "type": "Copy",
                        "dependsOn": [],
                        "policy": {
                            "timeout": "7.00:00:00",
                            "retry": 0,
                            "retryIntervalInSeconds": 30,
                            "secureOutput": false,
                            "secureInput": false
                        },
                        "userProperties": [
                            {
                                "name": "Source",
                                "value": "dbo.@{item().source.table}"
                            },
                            {
                                "name": "Destination",
                                "value": "@{item().destination.fileName}"
                            }
                        ],




 "parameters": {
            "cw_items": {
                "type": "Array",
                "defaultValue": [
                    {
                        "source": {
                            "table": "Cust1"
                        },
                        "destination": {
                            "fileName": "Cust1.csv"
                        }
                    },
                    {
                        "source": {
                            "table": "Cust2"
                        },
                        "destination": {
                            "fileName": "Cust2.csv"
                        }
                    },

1 个答案:

答案 0 :(得分:0)

我尝试了相同的导出,但是效果很好,所有的csv文件都存储在containerleon/csv中:

JSON代码参考:

{
    "name": "CopyPipeline_fls",
    "properties": {
        "activities": [
            {
                "name": "ForEach_fls",
                "type": "ForEach",
                "dependsOn": [],
                "userProperties": [],
                "typeProperties": {
                    "items": {
                        "value": "@pipeline().parameters.cw_items",
                        "type": "Expression"
                    },
                    "activities": [
                        {
                            "name": "Copy_fls",
                            "type": "Copy",
                            "dependsOn": [],
                            "policy": {
                                "timeout": "7.00:00:00",
                                "retry": 0,
                                "retryIntervalInSeconds": 30,
                                "secureOutput": false,
                                "secureInput": false
                            },
                            "userProperties": [
                                {
                                    "name": "Source",
                                    "value": "dbo.@{item().source.table}"
                                },
                                {
                                    "name": "Destination",
                                    "value": "containerleon/csv/@{item().destination.fileName}"
                                }
                            ],
                            "typeProperties": {
                                "source": {
                                    "type": "AzureSqlSource"
                                },
                                "sink": {
                                    "type": "DelimitedTextSink",
                                    "storeSettings": {
                                        "type": "AzureBlobStorageWriteSettings"
                                    },
                                    "formatSettings": {
                                        "type": "DelimitedTextWriteSettings",
                                        "quoteAllText": true,
                                        "fileExtension": ".txt"
                                    }
                                },
                                "enableStaging": false
                            },
                            "inputs": [
                                {
                                    "referenceName": "SourceDataset_fls",
                                    "type": "DatasetReference",
                                    "parameters": {
                                        "cw_table": "@item().source.table"
                                    }
                                }
                            ],
                            "outputs": [
                                {
                                    "referenceName": "DestinationDataset_fls",
                                    "type": "DatasetReference",
                                    "parameters": {
                                        "cw_fileName": "@item().destination.fileName"
                                    }
                                }
                            ]
                        }
                    ]
                }
            }
        ],
        "parameters": {
            "cw_items": {
                "type": "Array",
                "defaultValue": [
                    {
                        "source": {
                            "table": "test"
                        },
                        "destination": {
                            "fileName": "dbotest.csv"
                        }
                    },
                    {
                        "source": {
                            "table": "test3"
                        },
                        "destination": {
                            "fileName": "dbotest3.csv"
                        }
                    }
                ]
            }
        },
        "annotations": []
    },
    "type": "Microsoft.DataFactory/factories/pipelines"
}

存储预览:

enter image description here

希望这会有所帮助。