来自 Azure 流分析的 Azure Cosmos DB 输出Azure Cosmos DB output from Azure Stream Analytics

Azure Cosmos DB 是一种分布全球的数据库服务,它提供全球范围内不设限的弹性缩放、丰富查询和自动索引(经由与构架无关的数据模型)。Azure Cosmos DB is a globally distributed database service that offers limitless elastic scale around the globe, rich query, and automatic indexing over schema-agnostic data models. 若要了解流分析的 Azure Cosmos DB 容器选项,请参阅将 Azure Cosmos DB 用作输出的流分析一文。To learn about Azure Cosmos DB container options for Stream Analytics, see the Stream Analytics with Azure Cosmos DB as output article.

流分析中的 Azure Cosmos DB 输出当前不可在 Azure 中国世纪互联和 Azure 德国 (T-Systems International) 区域中使用。Azure Cosmos DB output from Stream Analytics is currently not available in the Azure China 21Vianet and Azure Germany (T-Systems International) regions.

备注

Azure 流分析仅支持使用 SQL API 连接到 Azure Cosmos DB。Azure Stream Analytics only supports connection to Azure Cosmos DB by using the SQL API. 尚不支持使用其他 Azure Cosmos DB API。Other Azure Cosmos DB APIs are not yet supported. 如果使用其他 API 将 Azure 流分析指向 创建的 Azure Cosmos DB 帐户,则可能无法正确存储数据。If you point Azure Stream Analytics to the Azure Cosmos DB accounts created with other APIs, the data might not be properly stored.

下表描述了用于创建 Azure Cosmos DB 输出的属性。The following table describes the properties for creating an Azure Cosmos DB output.

属性名称Property name 说明Description
输出别名Output alias 用于在流分析查询中引用此输出的别名。An alias to refer this output in your Stream Analytics query.
接收器Sink Azure Cosmos DB。Azure Cosmos DB.
导入选项Import option 选择“从订阅中选择 Cosmos DB”或“手动提供 Cosmos DB 设置” 。Choose either Select Cosmos DB from your subscription or Provide Cosmos DB settings manually.
帐户 IDAccount ID Azure Cosmos DB 帐户的名称或终结点 URI。The name or endpoint URI of the Azure Cosmos DB account.
帐户密钥Account key Azure Cosmos DB 帐户的共享访问密钥。The shared access key for the Azure Cosmos DB account.
数据库Database Azure Cosmos DB 数据库名称。The Azure Cosmos DB database name.
容器名称Container name 要使用的容器名称,该名称必须在 Cosmos DB 中存在。The container name to be used, which must exist in Cosmos DB. 示例:Example:
  • MyContainer:名为“MyContainer”的容器必须存在。MyContainer: A container named "MyContainer" must exist.
文档 IDDocument ID 可选。Optional. 输出事件中的字段的名称,该字段用于指定插入或更新操作所基于的主键。The name of the field in output events that's used to specify the primary key on which insert or update operations are based.

分区Partitioning

分区键基于查询中的 PARTITION BY 子句。The partition key is based on the PARTITION BY clause in the query. 输出编写器的数量与完全并行化的查询的输入分区一致。The number of output writers follows the input partitioning for fully parallelized queries. 流分析会将 Cosmos DB 输出分区键转换为字符串。Stream Analytics converts the Cosmos DB output partition key to a string. 例如,如果分区键的值为 bigint 类型的 1,则它将转换为字符串类型的“1”。For example, if you have a partition key with a value of 1 of type bigint, it is converted to "1" of type string.

输出批大小Output batch size

有关最大消息大小,请参阅 Azure Cosmos DB 限制For the maximum message size, see Azure Cosmos DB limits. 批大小和写入频率根据 Azure Cosmos DB 响应动态调整。Batch size and write frequency are adjusted dynamically based on Azure Cosmos DB responses. 流分析不会施加预先确定的限制。There are no predetermined limitations from Stream Analytics.

后续步骤Next steps