You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
15
15
16
-
# Azure Cosmos DB SQL API client library for Python - Version 4.3.0b2
16
+
# Azure Cosmos DB SQL API client library for Python - Version 4.3.0b3
17
17
18
18
19
19
Azure Cosmos DB is a globally distributed, multi-model database service that supports document, key-value, wide-column, and graph databases.
@@ -33,7 +33,7 @@ Use the Azure Cosmos DB SQL API SDK for Python to manage databases and the JSON
33
33
34
34
### Important update on Python 2.x Support
35
35
36
-
New releases of this SDK won't support Python 2.x starting January 1st, 2022. Please check the [CHANGELOG](https://github.com/Azure/azure-sdk-for-python/blob/azure-cosmos_4.3.0b2/sdk/cosmos/azure-cosmos/CHANGELOG.md) for more information.
36
+
New releases of this SDK won't support Python 2.x starting January 1st, 2022. Please check the [CHANGELOG](https://github.com/Azure/azure-sdk-for-python/blob/azure-cosmos_4.3.0b3/sdk/cosmos/azure-cosmos/CHANGELOG.md) for more information.
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.
112
112
113
+
## Note on client consistency levels
114
+
115
+
As of release version 4.3.0b3, if a user does not pass in an explicit consistency level to their client initialization,
116
+
their client will use their database account's default level. Previously, the default was being set to `Session` consistency.
117
+
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:
Currently the features below are **not supported**. For alternatives options, check the **Workarounds** section below.
@@ -127,8 +141,6 @@ Currently the features below are **not supported**. For alternatives options, ch
127
141
* Change Feed: Read from the beggining
128
142
* Change Feed: Pull model
129
143
* Cross-partition ORDER BY for mixed types
130
-
* Integrated Cache using the default consistency level, that is "Session". To take advantage of the new [Cosmos DB Integrated Cache](https://docs.microsoft.com/azure/cosmos-db/integrated-cache), it is required to explicitly set CosmosClient consistency level to "Eventual": `consistency_level= Eventual`.
131
-
* Cross partition queries do not handle partition splits (410 Gone errors)
132
144
133
145
### Control Plane Limitations:
134
146
@@ -152,16 +164,12 @@ If you want to use Python SDK to perform bulk inserts to Cosmos DB, the best alt
152
164
153
165
### Control Plane Limitations Workaround
154
166
155
-
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.
167
+
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.
156
168
157
169
### AAD Support Workaround
158
170
159
171
A possible workaround is to use managed identities to [programmatically](https://docs.microsoft.com/azure/cosmos-db/managed-identity-based-authentication) get the keys.
160
172
161
-
## Consistency Level
162
-
163
-
Please be aware that this SDK has "Session" as the default consistency level, and it **overrides** your Cosmos DB database account default option. Click [here](https://docs.microsoft.com/azure/cosmos-db/consistency-levels#eventual-consistency) to learn more about Cosmos DB consistency levels.
164
-
165
173
## Boolean Data Type
166
174
167
175
While the Python language [uses](https://docs.python.org/3/library/stdtypes.html?highlight=boolean#truth-value-testing) "True" and "False" for boolean types, Cosmos DB [accepts](https://docs.microsoft.com/azure/cosmos-db/sql-query-is-bool) "true" and "false" only. In other words, the Python language uses Boolean values with the first uppercase letter and all other lowercase letters, while Cosmos DB and its SQL language use only lowercase letters for those same Boolean values. How to deal with this challenge?
@@ -452,20 +460,22 @@ For more information on TTL, see [Time to Live for Azure Cosmos DB data][cosmos_
452
460
### Using the asynchronous client (Preview)
453
461
454
462
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.
463
+
The Async client needs to be initialized and closed after usage. The example below shows how to do so by using the client's __aenter__() and close() methods.
await client.close() # the async client must be closed manually if it's not initialized in a with statement
477
487
```
478
488
479
-
It is also worth pointing out that the asynchronous client has to be closed manually after its use, either by initializing it using async with or calling the close() method directly like shown above.
489
+
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.
0 commit comments