2017-10-18 99 views
0

我收到的错误与我在查询中发送的内容不匹配。流分析到CosmosDB总是失败

我的查询:

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] 

这里的出口配置:

enter image description here

我已经尝试设置DocumentId属性DocumentIdid没有成功。我甚至会在结果中添加额外的ID,DocumentId和PartitionKey字段,只是为了获得保存的成功而没有成功(也尝试单独运行将id或DocumentId放入CosmosDB Document 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

回答

2

DocumentDB抱怨已经配置集合的分区键为DocumentId,但没有这样的柱子在你的输出,我发现的时候。我别名在ASA的列在输出的列名最后小写...

ASA不关心案件,但DocumentDB会。尝试使用分区键设置为documentid来创建新集合。您可以在docdb的门户中的“设置”下查看当前的密钥。

注意Document id在ASA输出属性中控制id字段中的内容。它可能与您在DocumentDB中分区的字段不同。例如,在我的一个工作中,我想通过deviceID组织数据库,但根据messageType确定文档。因为我必须别名deviceID,它会丢失大写字母,我必须将分区键设置为deviceid。然后,我把我的Document idmessageType

enter image description here

enter image description here

我得到的是这样的文件:

{ “设备ID”: “MyDeviceIdentifier”, /... /, “id”:“MyMessageType” }