列名称中带有@的Azure数据工厂数据集

时间:2018-09-25 06:33:45

标签: azure-data-factory

我有一个来自Rest Web服务的数据集,在列名称中有一个@: 喜欢:     { data[{ @id : 1, @value : "a" }, { @id : 2, @value : "b" } ] }

我想在foreach中使用它并访问特定的列: 在foreach中,我得到类似@activity('Lookup').output.value

的输出

在foreach中有一个存储过程 作为参数输入,我尝试获取该列:我尝试了@item().@value,但收到错误消息“字符串字符'@'不在位置'xx'上”。

是否可以在列名中转义@?还是可以重命名该列?

非常感谢您

编辑: 这是ADF管道中的JSON:

{
"name": "pipeline3",
"properties": {
    "activities": [
        {
            "name": "Lookup1",
            "type": "Lookup",
            "policy": {
                "timeout": "7.00:00:00",
                "retry": 0,
                "retryIntervalInSeconds": 30,
                "secureOutput": false,
                "secureInput": false
            },
            "typeProperties": {
                "source": {
                    "type": "HttpSource",
                    "httpRequestTimeout": "00:01:40"
                },
                "dataset": {
                    "referenceName": "HttpFile1",
                    "type": "DatasetReference"
                },
                "firstRowOnly": false
            }
        },
        {
            "name": "ForEach2",
            "type": "ForEach",
            "dependsOn": [
                {
                    "activity": "Lookup1",
                    "dependencyConditions": [
                        "Succeeded"
                    ]
                }
            ],
            "typeProperties": {
                "items": {
                    "value": "@activity('Lookup1').output.value",
                    "type": "Expression"
                },
                "activities": [
                    {
                        "name": "Stored Procedure12",
                        "type": "SqlServerStoredProcedure",
                        "policy": {
                            "timeout": "7.00:00:00",
                            "retry": 0,
                            "retryIntervalInSeconds": 30,
                            "secureOutput": false,
                            "secureInput": false
                        },
                        "typeProperties": {
                            "storedProcedureName": "[dbo].[testnv]",
                            "storedProcedureParameters": {
                                "d": {
                                    "value": {
                                        "value": "@item().@accno",
                                        "type": "Expression"
                                    },
                                    "type": "String"
                                }
                            }
                        },
                        "linkedServiceName": {
                            "referenceName": "AzureSqlDatabase1",
                            "type": "LinkedServiceReference"
                        }
                    }
                ]
            }
        }
    ]
},
"type": "Microsoft.DataFactory/factories/pipelines"

}

1 个答案:

答案 0 :(得分:2)

请为@item()尝试“ @item()['@ accno']”。@ accno 在MSDN中也得到了答复。