2017-10-18 48 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」 }