Skip to content

Commit 3c03c04

Browse files
[Cosmos] added additional warning to default consistency change (Azure#23225)
* Update CHANGELOG.md * Apply suggestions from code review Co-authored-by: Kushagra Thapar <kushuthapar@gmail.com> * updated readme and changelog * Update CHANGELOG.md Co-authored-by: Kushagra Thapar <kushuthapar@gmail.com>
1 parent da0e1d7 commit 3c03c04

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

sdk/cosmos/azure-cosmos/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
### 4.3.0b3 (Unreleased)
44

5+
>[WARNING]
6+
>The default `Session` consistency bugfix will impact customers whose database accounts have a `Bounded Staleness` or `Strong`
7+
> consistency level, and were previously not sending `Session` as a consistency_level parameter when initializing
8+
> their clients.
9+
> Default consistency level for the sync and async clients is no longer "Session" and will instead be set to the
10+
consistency level of the user's cosmos account setting on initialization if not passed during client initialization.
11+
> Please see [Consistency Levels in Azure Cosmos DB](https://docs.microsoft.com/azure/cosmos-db/consistency-levels)
12+
> for more details on consistency levels, or the README section on this change [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cosmos/azure-cosmos#note-on-client-consistency-levels).
13+
514
#### Features Added
615
- Added support for split-proof queries for the async client
716

sdk/cosmos/azure-cosmos/README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ The keyword-argument `enable_cross_partition_query` accepts 2 options: `None` (d
9797

9898
When using queries that try to find items based on an **id** value, always make sure you are passing in a string type variable. Azure Cosmos DB only allows string id values and if you use any other datatype, this SDK will return no results and no error messages.
9999

100+
## Note on client consistency levels
101+
102+
As of release version 4.3.0b3, if a user does not pass in an explicit consistency level to their client initialization,
103+
their client will use their database account's default level. Previously, the default was being set to `Session` consistency.
104+
If for some reason you'd like to keep doing this, you can change your client initialization to include the explicit parameter for this like shown:
105+
```Python
106+
from azure.cosmos import CosmosClient
107+
108+
import os
109+
URL = os.environ['ACCOUNT_URI']
110+
KEY = os.environ['ACCOUNT_KEY']
111+
client = CosmosClient(URL, credential=KEY, consistency_level='Session')
112+
```
113+
100114
## Limitations
101115

102116
Currently the features below are **not supported**. For alternatives options, check the **Workarounds** section below.
@@ -114,7 +128,6 @@ Currently the features below are **not supported**. For alternatives options, ch
114128
* Change Feed: Read from the beggining
115129
* Change Feed: Pull model
116130
* Cross-partition ORDER BY for mixed types
117-
* Cross partition queries do not handle partition splits (410 Gone errors)
118131

119132
### Control Plane Limitations:
120133

@@ -138,7 +151,7 @@ If you want to use Python SDK to perform bulk inserts to Cosmos DB, the best alt
138151

139152
### Control Plane Limitations Workaround
140153

141-
Typically you can use [Azure Portal](https://portal.azure.com/), [Azure Cosmos DB Resource Provider REST API](https://docs.microsoft.com/rest/api/cosmos-db-resource-provider), [Azure CLI](https://docs.microsoft.com/cli/azure/azure-cli-reference-for-cosmos-db) or [PowerShell](https://docs.microsoft.com/azure/cosmos-db/manage-with-powershell) for the control plane unsupported limitations.
154+
Typically, you can use [Azure Portal](https://portal.azure.com/), [Azure Cosmos DB Resource Provider REST API](https://docs.microsoft.com/rest/api/cosmos-db-resource-provider), [Azure CLI](https://docs.microsoft.com/cli/azure/azure-cli-reference-for-cosmos-db) or [PowerShell](https://docs.microsoft.com/azure/cosmos-db/manage-with-powershell) for the control plane unsupported limitations.
142155

143156
### AAD Support Workaround
144157

0 commit comments

Comments
 (0)