我得到的错误与我在查询中发送的错误不符 .
我的查询:
SELECT
udf.CreateGuid('') AS [id],
udf.CreateGuid('') AS [DocumentId],
BlobName,
BlobLastModifiedUtcTime,
[telmetry].[event_type] as PartitionKey,
-- webhook
[telmetry].[id] AS [hook_id],
[telmetry].[event_version],
[telmetry].[create_time],
[telmetry].[resource_type],
[telmetry].[event_type],
[telmetry].[summary],
[telmetry].[resource],
[telmetry].[links]
INTO
[cosmosdb2]
FROM
[telemetrydepot] AS [telmetry]
TIMESTAMP BY [telmetry].[create_time]
这是导出配置:
我已经尝试将DocumentId属性设置为 DocumentId
或 id
但没有成功 . 我没有得到任何保存......
我得到的错误说:
An error occurred while preparing data for DocumentDB. The output record does not contain the column DocumentId to use as the partition key property by DocumentDB
1 回答
DocumentDB抱怨你've configured the collection'的分区键为
DocumentId
但输出中没有这样的列 . 我发现当我在ASA中对列进行别名时,输出中的列名最终为小写...ASA并不关心这个案例,但DocumentDB会这样做 . 尝试创建一个分区键设置为
documentid
的新集合 . 您可以在docdb的门户中查看"settings"下的当前密钥 .注意ASA输出属性中的
Document id
控制id
字段中的内容 . 它可能与您在DocumentDB中分区的字段不同 . 例如,在我的一个工作中,我想通过deviceID
组织数据库,但根据messageType
识别文档 . 因为我必须别名deviceID
,它会丢失大写字母,我必须将分区键设置为deviceid
. 然后我将Document id
设置为messageType
:我得到的文档看起来像这样:
{"deviceid":"MyDeviceIdentifier",/ ...... /,_ "id":"MyMessageType"}