简体   繁体   English

将 JSON 映射到 SQL 的 Azure 数据工厂复制活动错误

[英]Azure Data Factory Copy Activity error mapping JSON to SQL

I have an Azure Data Factory Copy Activity that is using a REST request to elastic search as the Source and attempting to map the response to a SQL table as the Sink.我有一个 Azure 数据工厂复制活动,它使用 REST 请求将弹性搜索作为源,并尝试将响应映射到 SQL 表作为接收器。 Everything works fine except when it attempts to map the data field that contains the dynamic JSON.一切正常,除非它尝试映射包含动态 JSON 的data字段。 I get the following error:我收到以下错误:

{ "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": [] } { "errorCode": "2200", "message": "ErrorCode=UserErrorUnsupportedHierarchicalComplexValue,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=检索到的数据类型 JObject,值为 {\\"name\\":\\"尚不支持部门\\"},请删除目标列或启用跳过不兼容的行以跳过它们。,Source=Microsoft.DataTransfer.Common,'", "failureType": "UserError", "target": "CopyContents_Paged “, “细节”: [] }

Here's an example of my mapping configuration:这是我的映射配置示例:

    "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']"
}

The JSON in the data object is dynamic so I'm unable to do an explicit mapping for the nested fields within it. data对象中的 JSON 是动态的,因此我无法对其中的嵌套字段进行显式映射。 That's why I'm trying to just store the entire JSON object under data in a column of a SQL table.这就是为什么我试图将整个 JSON 对象data在 SQL 表的列中的data下。

How can I adjust my mapping configuration to allow this to work properly?如何调整我的映射配置以使其正常工作?

I posted this question on the MSDN forums and I was told that if you are using a tabular sink you can set this option "mapComplexValuesToString": true and it should allow complex JSON properties to get mapped correctly.我在 MSDN 论坛上发布了这个问题,有人告诉我,如果您使用的是表格接收器,您可以设置此选项"mapComplexValuesToString": true并且它应该允许正确映射复杂的 JSON 属性。 This resolved my ADF copy activity issue.这解决了我的 ADF 复制活动问题。

I have the same problem a few days ago.几天前我遇到了同样的问题。 You need to convert your JSON object to a Json String.您需要将 JSON 对象转换为 Json 字符串。 It will solve your mapping problem (UserErrorUnsupportedHierarchicalComplexValue).它将解决您的映射问题(UserErrorUnsupportedHierarchicalComplexValue)。

Try it and tell me if also resolves your error.试试看,告诉我是否也能解决你的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure 数据工厂复制活动失败将字符串(从 csv)映射到 Azure SQL 表接收器 uniqueidentifier 字段 - Azure Data factory copy activity failed mapping strings (from csv) to Azure SQL table sink uniqueidentifier field 使用触发器中的 Azure 数据工厂复制数据活动映射 - Azure Data Factory Copy Data Activity Mapping in Using Triggers Azure 数据工厂复制活动动态映射错误:语法错误:arguments 之间缺少逗号 - Azure data factory copy activity dynamic mapping error : Syntax error: Missing comma between arguments Azure Data Factory V2复制活动映射部署问题 - Azure Data Factory V2 Copy activity Mapping deployment issue Azure数据工厂复制活动 - Azure Data Factory Copy Activity Azure 数据工厂复制活动 JSON 数据类型转换问题 - Azure Data Factory copy activity JSON data type conversion issue Azure 数据工厂 - 将查找活动输出复制到 blob 中的 json - Azure Data Factory - copy Lookup activity output to json in blob Azure SQL 具有接收器存储过程的数据工厂复制活动 - Azure SQL Data Factory Copy Activity with Sink Stored Procedure Azure数据工厂数据复制源中的查找活动-语法错误 - Lookup activity in an Azure Data Factory Data Copy Source - Syntax Error 值 2150002867256 的复制活动中的类型转换错误:Azure 数据工厂 - Type Conversion Error in Copy activity for value 2150002867256: Azure data factory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM