首页 文章

在Data Factory V2中读取Azure blob的容器名称

提问于
浏览
0

我的Data Factory V2管道从Azure blob导入CSV文件 .

Data Factory V2中是否有任何方法可以自动读取CSV文件的容器名称?我搜索将它们交给Microsoft SQL Server和/或将它们保存在流式CSV数据本身中 .

1 回答

  • 1

    正如评论中提到的那样,Azure Blob存储中没有名为文件夹的东西 . 您只能获取容器的名称 .

    基于Azure Data Factory REST API,您可以从 dataset 响应正文中获取 folderPath .

    样品:

    {
      "id": "/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/datasets/exampleDataset",
      "name": "exampleDataset",
      "properties": {
        "type": "AzureBlob",
        "typeProperties": {
          "folderPath": {
            "value": "@dataset().MyFolderPath",
            "type": "Expression"
          },
          "fileName": {
            "value": "@dataset().MyFileName",
            "type": "Expression"
          },
          "format": {
            "type": "TextFormat"
          }
        },
        "description": "Example description",
        "linkedServiceName": {
          "referenceName": "exampleLinkedService",
          "type": "LinkedServiceReference"
        },
        "parameters": {
          "MyFolderPath": {
            "type": "String"
          },
          "MyFileName": {
            "type": "String"
          }
        }
      },
      "etag": "280320a7-0000-0000-0000-59b9712a0000"
    }
    

    或者你可以在Azure Data Factory SDK获得该 properties . 然后,您可以将名称保存到Microsoft SQL Server .

    希望它能帮到你 .

相关问题