azure - 将分析流式传输到 CosmosDB 总是失败

标签 azure azure-cosmosdb azure-stream-analytics

我收到的错误与我在查询中发送的错误不匹配。

我的查询:

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 属性中。无法保存任何内容...

我返回的错误是:

为 DocumentDB 准备数据时发生错误。输出记录不包含 DocumentDB 用作分区键属性的 DocumentId 列

最佳答案

DocumentDB 提示您已将集合的分区键配置为 DocumentId,但输出中没有此类列。我发现当我在 ASA 中为列添加别名时,输出中的列名称以小写结尾...

ASA 不关心这种情况,但 DocumentDB 会关心。尝试创建一个新集合,并将分区键设置为 documentid。您可以在 docdb 门户的“设置”下查看当前 key 。

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

enter image description here

enter image description here

我得到的文档如下所示:

{ "deviceid": "我的设备标识符", /.../, "id": "我的消息类型" }

关于azure - 将分析流式传输到 CosmosDB 总是失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46814183/

相关文章:

azure - 流分析:When using a TUMBLING WINDOW is the start time of the window start based on the earliest time in the stream or start time of the job?

c# - 本地启动 Azure 云服务时显示 "Crypto settings changed"消息

apache - 使用 apache 在 Azure 上设置 ubuntu VM

node.js - 使用 Azure Node SDK 获取应用程序设置

javascript - 这个 .find 函数有什么根本性的错误吗? ( Mongoose )

Azure Cosmos Db 文档 - 想要对文档中已删除的属性使用 ReplaceDocumentAsync

sql-server - 如何从 Azure SQL 调用 Webservice/CLR 函数

Azure 流分析 - 未找到引用 Blob

azure - Azure 帐户中的多个订阅流式传输到单个 EventHub

t-sql - Azure 流分析将多个输入分组到一个输出