Skip to content

Files

53 lines (39 loc) · 3.67 KB

azure-cosmos-db-output.md

File metadata and controls

53 lines (39 loc) · 3.67 KB
title description author ms.author ms.service ms.topic ms.date
Azure Cosmos DB output from Azure Stream Analytics
This article describes how to output data from Azure Stream Analytics to Azure Cosmos DB.
enkrumah
ebnkruma
stream-analytics
conceptual
12/13/2021

Azure Cosmos DB output from Azure Stream Analytics

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. 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 output from Stream Analytics is currently not available in the Azure China 21Vianet and Azure Germany (T-Systems International) regions.

Note

Azure Stream Analytics only supports connection to Azure Cosmos DB by using the SQL API. Other Azure Cosmos DB APIs are not yet supported. If you point Azure Stream Analytics to the Azure Cosmos DB accounts created with other APIs, the data might not be properly stored.

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.
Import option Choose either Select Cosmos DB from your subscription or Provide Cosmos DB settings manually.
Account ID The name or endpoint URI of the Azure Cosmos DB account.
Account key The shared access key for the Azure Cosmos DB account.
Database The Azure Cosmos DB database name.
Container name The container name to be used, which must exist in Cosmos DB. Example:
  • MyContainer: A container named "MyContainer" must exist.
Document 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.

Note

Cosmos DB Output for Azure Stream Analytics uses .NET V3 SDK. When writing to multiple regions, the SDK automatically picks the best region available.

Partitioning

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. Stream Analytics converts the Cosmos DB output partition key to a string. For example, if you have a partition key with a value of 1 of type bigint, it is converted to "1" of type string. This conversion always happens regardless of whether the partition property is written to Cosmos DB.

Output batch size

For the maximum message size, see Azure Cosmos DB limits. Batch size and write frequency are adjusted dynamically based on Azure Cosmos DB responses. There are no predetermined limitations from Stream Analytics.

Next steps