diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index 20033fb1bf0b..40b106fc3a67 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -3,14 +3,15 @@ ### 4.3.0b3 (Unreleased) #### Features Added -- Added support for split-proof queries for the async client +- Added support for split-proof queries for the async client. ### Bugs fixed - Default consistency level for the sync and async clients is no longer "Session" and will instead be set to the - consistency level of the user's cosmos account setting on initialization if not passed during client initialization. + consistency level of the user's cosmos account setting on initialization if not passed during client initialization. This change will impact client application in terms of RUs and latency. Users relying on default `Session` consistency will need to pass it explicitly if their account consistency is different than `Session`. Please see [Consistency Levels in Azure Cosmos DB](https://docs.microsoft.com/azure/cosmos-db/consistency-levels) for more details. - Fixed invalid request body being sent when passing in `serverScript` body parameter to replace operations for trigger, sproc and udf resources. +- Moved `is_system_key` logic in async client. - Fixed TypeErrors not being thrown when passing in invalid connection retry policies to the client. ### 4.3.0b2 (2022-01-25) @@ -19,15 +20,15 @@ This version and all future versions will require Python 3.6+. Python 2.7 is no We will also be removing support for Python 3.6 and will only support Python 3.7+ starting December 2022. #### Features Added -- Added support for split-proof queries for the sync client +- Added support for split-proof queries for the sync client. #### Other Changes -- Added async user agent for async client +- Added async user agent for async client. ### 4.3.0b1 (2021-12-14) #### Features Added -- Added language native async i/o client +- Added language native async i/o client. ### 4.2.0 (2020-10-08) diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_query_iterable_async.py b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_query_iterable_async.py index bf53ac0d1432..0752bbf9e4f2 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_query_iterable_async.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_query_iterable_async.py @@ -21,6 +21,7 @@ """Iterable query results in the Azure Cosmos database service. """ +import asyncio from azure.core.async_paging import AsyncPageIterator from azure.cosmos._execution_context.aio import execution_dispatcher @@ -77,11 +78,6 @@ def __init__( ) super(QueryIterable, self).__init__(self._fetch_next, self._unpack, continuation_token=continuation_token) - async def __aiter__(self): - if 'partition_key' in self._options: - self._options['partition_key'] = await self._options['partition_key'] - return self - async def _unpack(self, block): continuation = None if self._client.last_response_headers: @@ -100,6 +96,9 @@ async def _fetch_next(self, *args): # pylint: disable=unused-argument :return: List of results. :rtype: list """ + + if 'partitionKey' in self._options and asyncio.iscoroutine(self._options['partitionKey']): + self._options['partitionKey'] = await self._options['partitionKey'] block = await self._ex_context.fetch_next_block() if not block: raise StopAsyncIteration diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/database.py b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/database.py index 3cd9ff3899e6..9561dae99192 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/database.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/database.py @@ -275,9 +275,7 @@ async def create_container_if_not_exists( analytical_storage_ttl = kwargs.pop("analytical_storage_ttl", None) try: container_proxy = self.get_container_client(id) - await container_proxy.read( - **kwargs - ) + await container_proxy.read(**kwargs) return container_proxy except CosmosResourceNotFoundError: return await self.create_container(