首页 > 解决方案 > Azure 数据工厂将活动 csv 复制到 cosmosdb 失败

问题描述

Azure 数据工厂复制活动

来源:csv 文件 接收器:cosmos db 操作:upsert

复制活动失败,代码为“2200”,id 字段存在问题,几周前就可以找到

我的 csv 文件有一个数字列,我将其用作 cosmos 文档的 id,因此我可以更新现有的

错误详情

{
'errorCode': '2200',
'message': 'ErrorCode=UserErrorDocumentDBWriteError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Documents failed to import due to invalid documents which violate some of Cosmos DB constraints: 1) Document size shouldn't exceeds 2MB; 2) Document's 'id' property must be string if any, and must not include the following charaters: '/', '\\\\', '?', '#'; 3) Document's 'ttl' property must not be non-digital type if any.,Source=Microsoft.DataTransfer.DocumentDbManagement,'',
'failureType': 'UserError',
'target': 'Copy_ToCosmosDB',
'details': []
}

标签: azureazure-cosmosdbazure-data-factory

解决方案


当您在 cosmos db 中插入项目时,请不要更改您的分区键。因为 cosmos db 中的分区键无法更改。更多详细信息请参阅此文档

例如:我的容器的分区键是/name,这里有一个这样的项目:

{
    "id": "2",
    "no": 2,
    "name": "Monica",
    "createTime": "2020-06-22T00:00:00.000Z",
    
}

我的 csv 文件是这样的(将 Monica 更新为 Monica):

id,no,name,createTime
2,2,Monican,2020-06-22T00:00:00.000Z

当我运行管道时,我会遇到同样的错误。


推荐阅读