【问题标题】:Dynamic table storage name动态表存储名称
【发布时间】:2017-03-09 10:31:56
【问题描述】:

数据工厂输入中是否可以有动态表存储表名?

我发现的所有东西都有一个修复名称

"properties": {
 "type": "AzureTable",
 "linkedServiceName": "StorageLinkedService",
 "typeProperties": {
     "tableName": "MyTable"
 },

情况是我想将动态表列表的数据复制到sql数据库中。

【问题讨论】:

    标签: azure-table-storage azure-data-factory azure-management-api


    【解决方案1】:

    您可以在 Azure 数据工厂 v2 中为 Azure 表存储数据集参数化表名。

    我在创作工具中手动创建了这个,但对应的(导出的)arm 模板如下所示:

    "parameters": {
        "table": {
            "type": "string"
        }
    },
    "annotations": [],
    "type": "AzureTable",
    "schema": [],
    "typeProperties": {
        "tableName": {
            "value": "@dataset().table",
            "type": "Expression"
        }
    }
    

    【讨论】:

      【解决方案2】:

      我相信您将不得不使用静态表名创建单独的数据集。动态表名是不可能的!!

      【讨论】:

        【解决方案3】:

        可惜没有!

        我刚刚测试过,我希望您能够从 partition by 子句中注入值。但是,这似乎仅在文件和文件夹名称中才有可能。 不适用于表格。

        请参见下面的屏幕截图。

        根据门户不允许,即使它在没有失败验证的情况下部署!!

        我刚刚为它创建了一个 MS 连接反馈项,链接如下。

        https://feedback.azure.com/forums/270578-data-factory/suggestions/18614509-support-the-partition-by-clause-for-azure-table-da

        投票支持将其添加到 ADF 功能中。

        【讨论】:

          【解决方案4】:

          如果您使用 .NET API,那么您可以实现它。

          使用Microsoft.Azure.Management.DataFactoriesnuget 包

          var dataFactoryClient = new DataFactoryClient {
              ResourceGroupName = "",
              DataFactoryName = ""
          }
          
          var client = dataFactoryClient.GetDataFactoryManagementClient();
          
          client.Datasets.CreateOrUpdate(ResourceGroupName, DataFactoryName,
                          new DatasetCreateOrUpdateParameters
                          {
                              Dataset = new Dataset
                              {
                                  Name = datasetName,
                                  Properties = new DatasetProperties
                                  {
                                      LinkedServiceName = linkedService,
                                      TypeProperties = new AzureTableDataset
                                      {
                                          TableName = tableName //append current date
          
                                      },
                                      External = external,
                                      Availability = availability,
                                      Structure = //DataElements
                                      Policy = new Policy {}
          
                                  }
                              }
                          });
          

          您还可以使用此 API 访问管道、活动、链接服务,并根据需要对其进行自定义。

          您可以使用 WebJob 来部署此 DataFactory。

          【讨论】:

            猜你喜欢
            • 2019-06-02
            • 1970-01-01
            • 2020-09-12
            • 1970-01-01
            • 2020-11-07
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多