Azure 数据工厂复制 Activity 错误映射 JSON 到 SQL

Azure Data Factory Copy Activity error mapping JSON to SQL

我有一个 Azure 数据工厂副本 Activity,它使用对弹性搜索的 REST 请求作为源并尝试将响应映射到 SQL table 作为接收器.一切正常,除非它试图映射包含动态 JSON 的 data 字段。我收到以下错误:

{ "errorCode": "2200", "message": "ErrorCode=UserErrorUnsupportedHierarchicalComplexValue,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=The retrieved type of data JObject with value {\"name\":\"department\"} is not supported yet, please either remove the targeted column or enable skip incompatible row to skip them.,Source=Microsoft.DataTransfer.Common,'", "failureType": "UserError", "target": "CopyContents_Paged", "details": [] }

这是我的映射配置示例:

    "type": "TabularTranslator",
    "mappings": [
        {
            "source": {
                "path": "['_source']['id']"
            },
            "sink": {
                "name": "ContentItemId",
                "type": "String"
            }
        },
        {
            "source": {
                "path": "['_source']['status']"
            },
            "sink": {
                "name": "Status",
                "type": "Int32"
            }
        },
        {
            "source": {
                "path": "['_source']['data']"
            },
            "sink": {
                "name": "Data",
                "type": "String"
            }
        }
    ],
    "collectionReference": "$['hits']['hits']"
}

data 对象中的 JSON 是动态的,因此我无法对其中的嵌套字段进行显式映射。这就是为什么我试图将整个 JSON 对象存储在 data 下的 SQL table.

列中

如何调整我的映射配置以使其正常工作?

我前几天遇到了同样的问题。您需要将 JSON 对象转换为 Json 字符串。它将解决您的映射问题 (UserErrorUnsupportedHierarchicalComplexValue)。

试一试,告诉我是否也解决了您的错误。

我在 MSDN 论坛上发布了这个问题,有人告诉我,如果您使用的是表格接收器,则可以设置此选项 "mapComplexValuesToString": true,它应该允许正确映射复杂的 JSON 属性.这解决了我的 ADF 副本 activity 问题。