azure-docs icon indicating copy to clipboard operation
azure-docs copied to clipboard

Python example for creating container with AutoScale enabled

Open kenuw opened this issue 2 years ago • 2 comments

Hello, I'm having trouble creating a container with AutoScale enabled using the Python SDK: database = client.get_database_client(database_id) container = database.create_container_if_not_exists( id=container_id, partition_key=partition_key, offer_throughput=4000)

I have successfully created an AutoScale container using the node.js sdk: await client .database(databaseId) .containers.createIfNotExists( { id: containerId, partitionKey, maxThroughput: 4000 } ); I'm assuming Python's 'offer_throughput' is equivalent to node's 'maxThroughput'. I'm unable to find a max_throughput in the documentation. Any help is much appreciated. Thanks


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

kenuw avatar Aug 12 '22 23:08 kenuw

Thank you for the detailed question. We are currently investigating and will update you when we have accurate information to provide.

Grace-MacJones-MSFT avatar Aug 13 '22 18:08 Grace-MacJones-MSFT

Hello again, I'm actually seeing that the Provisioning of Autoscale containers is a limitation in the current SDK. Can anyone confirm this and possible offer a work around? Thanks

Autoscale limitation

kenuw avatar Aug 16 '22 16:08 kenuw

@deborahc could you please share your input regarding the above request.

Oury-MSFT avatar Aug 17 '22 19:08 Oury-MSFT

#reassign:seesharprun

Yes, this is a feature not currently supported in the Python SDK. You can work around this by using the REST API. If you need assistance with using the REST API, please visit our Q&A forums.

#please-close

seesharprun avatar Aug 25 '22 15:08 seesharprun

Thanks @seesharprun . Do we know if/when Autoscale will be added to the Python SDK? While using the rest api is an option, creating the Authorization string required by the rest call seems a bit complicated (looking at this article). It would be helpful if they had examples for Python seeing as Py folks will be forced to use the REST API if they need Autoscale. Thx

kenuw avatar Oct 28 '22 15:10 kenuw

Unfortunately, I do not have a timeline on when Autoscale will be added to the Python SDK.

seesharprun avatar Oct 29 '22 23:10 seesharprun

Can we update this thread when it more info becomes available? Thanks.

kenuw avatar Nov 03 '22 18:11 kenuw

Can we have update on this when autoscale option wil be available in python SDK

Jayaprakash806 avatar Feb 10 '23 09:02 Jayaprakash806

For anyone still looking for container autoscale option, it is possible to set the autoscaling option through ThroughputProperties Something like this:

from azure.cosmos.offer import ThroughputProperties
throughput_properties = ThroughputProperties({"auto_scale_max_throughput": 1000})
container = database.create_container_if_not_exists( id=container_id, partition_key=partition_key, offer_throughput=throughput_properties)

For existing containers the throughput can be changed using:

container.replace_throughput(throughput_properties)

asad200 avatar Aug 10 '23 14:08 asad200