Skip to content

Commit 8fa6cee

Browse files
authored
changelog for release and updates on using the async client on readme (#34131)
1 parent 221cbf0 commit 8fa6cee

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

sdk/cosmos/azure-cosmos/CHANGELOG.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
## Release History
22

3-
### 4.5.2b4 (Unreleased)
3+
### 4.5.2b4 (2024-02-02)
44
This version and all future versions will require Python 3.8+.
55

66
#### Features Added
77
* Added **preview** support for Computed Properties on Python SDK (Must be enabled on the account level before it can be used). See [PR 33626](https://github.com/Azure/azure-sdk-for-python/pull/33626).
88

9-
#### Breaking Changes
10-
119
#### Bugs Fixed
12-
13-
#### Other Changes
10+
* Made use of `response_hook` thread-safe in the sync client. See [PR 33790](https://github.com/Azure/azure-sdk-for-python/pull/33790).
11+
* Fixed bug with the session container not being properly maintained. See [33738](https://github.com/Azure/azure-sdk-for-python/pull/33738).
1412

1513
### 4.5.2b3 (2023-11-10)
1614

1715
#### Features Added
18-
* Added support for capturing Index Metrics in query operations. See [PR 33034](https://github.com/Azure/azure-sdk-for-python/pull/33034)
16+
* Added support for capturing Index Metrics in query operations. See [PR 33034](https://github.com/Azure/azure-sdk-for-python/pull/33034).
1917

2018
### 4.5.2b2 (2023-10-31)
2119

sdk/cosmos/azure-cosmos/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ For more information on TTL, see [Time to Live for Azure Cosmos DB data][cosmos_
475475
### Using the asynchronous client
476476

477477
The asynchronous cosmos client is a separate client that looks and works in a similar fashion to the existing synchronous client. However, the async client needs to be imported separately and its methods need to be used with the async/await keywords.
478-
The Async client needs to be initialized and closed after usage, which can be done manually or with the use of a context manager. The example below shows how to do so manually.
478+
The Async client needs to be initialized and closed after usage, which can be done manually or with the use of a context manager. The example below shows how to do so manually. We don't recommend doing it this way, since it requires that you manually call __aenter__() before using the client.
479479

480480
```python
481481
from azure.cosmos.aio import CosmosClient
@@ -488,6 +488,7 @@ CONTAINER_NAME = 'products'
488488

489489
async def create_products():
490490
client = CosmosClient(URL, credential=KEY)
491+
await client.__aenter__() # this piece is important for the SDK to cache account information
491492
database = client.get_database_client(DATABASE_NAME)
492493
container = database.get_container_client(CONTAINER_NAME)
493494
for i in range(10):
@@ -500,7 +501,7 @@ async def create_products():
500501
await client.close() # the async client must be closed manually if it's not initialized in a with statement
501502
```
502503

503-
Instead of manually opening and closing the client, it is highly recommended to use the `async with` keywords. This creates a context manager that will initialize and later close the client once you're out of the statement. The example below shows how to do so.
504+
Instead of manually opening and closing the client, it is highly recommended to use the `async with` keywords. This creates a context manager that will initialize and later close the client once you're out of the statement, as well as cache important information the SDK needs. The example below shows how to do so.
504505

505506
```python
506507
from azure.cosmos.aio import CosmosClient

0 commit comments

Comments
 (0)