将分析流式传输到 CosmosDB 总是失败
Stream Analytics to CosmosDB always fails
我收到的错误与我在查询中发送的错误不匹配。
我的查询:
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
但没有成功。我什至将额外的 ID、DocumentId 和 PartitionKey 字段添加到结果中只是为了保存一些东西但没有成功(还尝试单独运行将 id 或 DocumentId 放入 CosmosDB 文档 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
DocumentDB 抱怨您已将集合的分区键配置为 DocumentId
,但您的输出中没有这样的列。我发现当我在 ASA 中为列添加别名时,输出中的列名最终变为小写...
ASA 不关心这种情况,但 DocumentDB 会。尝试创建一个分区键设置为 documentid
的新集合。您可以在 docdb 门户的 "settings" 下查看当前密钥。
注意 ASA 输出属性中的 Document id
控制 id
字段中的内容。它可以与您在 DocumentDB 中分区所依据的字段不同。例如,在我的一项工作中,我想按 deviceID
组织数据库,但根据 messageType
识别文档。因为我必须为 deviceID
添加别名,所以它丢失了大写字母,我必须将分区键设置为 deviceid
。然后我将 Document id
设置为 messageType
:
我得到的文件看起来像这样:
{
"deviceid": "MyDeviceIdentifier",
/.../,
"id": "MyMessageType"
}
我收到的错误与我在查询中发送的错误不匹配。
我的查询:
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
但没有成功。我什至将额外的 ID、DocumentId 和 PartitionKey 字段添加到结果中只是为了保存一些东西但没有成功(还尝试单独运行将 id 或 DocumentId 放入 CosmosDB 文档 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
DocumentDB 抱怨您已将集合的分区键配置为 DocumentId
,但您的输出中没有这样的列。我发现当我在 ASA 中为列添加别名时,输出中的列名最终变为小写...
ASA 不关心这种情况,但 DocumentDB 会。尝试创建一个分区键设置为 documentid
的新集合。您可以在 docdb 门户的 "settings" 下查看当前密钥。
注意 ASA 输出属性中的 Document id
控制 id
字段中的内容。它可以与您在 DocumentDB 中分区所依据的字段不同。例如,在我的一项工作中,我想按 deviceID
组织数据库,但根据 messageType
识别文档。因为我必须为 deviceID
添加别名,所以它丢失了大写字母,我必须将分区键设置为 deviceid
。然后我将 Document id
设置为 messageType
:
我得到的文件看起来像这样:
{ "deviceid": "MyDeviceIdentifier", /.../, "id": "MyMessageType" }