【问题标题】:Azure Data Factory - Dynamic Account information - Parameterization of ConnectionAzure 数据工厂 - 动态帐户信息 - 连接参数化
【发布时间】:2019-07-11 18:37:09
【问题描述】:

该文档演示了如何为连接的服务创建参数,但没有演示如何从数据集或活动中实际传递该参数。基本上,连接字符串来自查找 foreach 循环,我想连接到存储表。

连接看起来像这样。传入正确的参数时测试有效:

{
    "name": "StatsStorage",
    "properties": {
        "type": "AzureTableStorage",
        "parameters": {
            "connectionString": {
                "type": "String"
            }
        },
        "annotations": [],
        "typeProperties": {
            "connectionString": "@{linkedService().connectionString}"
        }
    }
}

数据集如下,我正在努力确定如何为连接设置 connectionString 参数。数据集有两个参数,来自 db 的连接字符串和需要连接的表名:

{
    "name": "TestTable",
    "properties": {
        "linkedServiceName": {
            "referenceName": "StatsStorage",
            "type": "LinkedServiceReference"
        },
        "parameters": {
            "ConnectionString": {
                "type": "string"
            },
            "TableName": {
                "type": "string"
            }
        },
        "annotations": [],
        "type": "AzureTable",
        "schema": [],
        "typeProperties": {
            "tableName": {
                "value": "@dataset().TableName",
                "type": "Expression"
            }
        }
    }
}

如何在连接上设置连接字符串?

【问题讨论】:

    标签: azure azure-data-factory azure-data-factory-2


    【解决方案1】:
    1. 首先,您不能将整个连接字符串作为表达式。您需要单独提供 accountName 和 accountKey。请参阅这篇文章以了解如何执行此操作。 How to provide connection string dynamically for azure table storage/blob storage in Azure data factory Linked service
    2. 然后,如果您使用的是 ADF UI,它将指导您如何为链接服务提供价值。例如,如果您有两个数据集参数,则可以将其指定如下。
    3. 如果要查看json代码,可以点击左上角的代码图标。
    4. 我以 azure blob 为例,但 azure 表几乎相同。 希望它可以帮助。

    【讨论】:

    • 这有帮助,您必须按照您的指示分解参数。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-03
    • 2020-02-15
    • 2021-09-10
    • 1970-01-01
    • 2023-01-04
    相关资源
    最近更新 更多