[英]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.