Sayantan Ghosh
Sayantan Ghosh

Reputation: 1056

How to create a CosmosDB Table with autoscale throughput in c#?

I am trying to create a table in a Cosmos DB with autoscale throughput configuration but I see the CloudTable CreateIfNotExists API has no option to specify autoscale while creating a table. How can I achieve the same?

public virtual bool CreateIfNotExists(IndexingMode indexingMode, int? throughput = null);
public virtual bool CreateIfNotExists(TableRequestOptions requestOptions = null, OperationContext operationContext = null, string serializedIndexingPolicy = null, int? throughput = null);

Upvotes: 0

Views: 635

Answers (2)

Janusz Nowak
Janusz Nowak

Reputation: 2848

I am author of implementation of Auto Scaling Azure Cosmos DB, because of lacking build in auto-scaling at that time https://github.com/JanuszNowak/Janono.Azure.DocumentsDB.Scale. Now Azure Cosmos DB support build in autoscaling https://learn.microsoft.com/en-us/azure/cosmos-db/provision-throughput-autoscale.

Upvotes: 1

Gaurav Mantri
Gaurav Mantri

Reputation: 136216

Looking at the release notes for Cosmos DB Table SDK (here and here), I believe that support for autoscale is still not there in the latest SDKs at this time (2.0.0-preview for .Net Standard).

As a workaround, what you can do is make use of Cosmos DB SQL API SDK (version 3.0 or more) and create a container with autoscale throughput. A container is essentially a table. You can find code sample to do the same here: https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-provision-autoscale-throughput?tabs=api-async#azure-cosmos-db-net-v3-sdk-for-sql-api.

Upvotes: 0

Related Questions