Skip to content

[Cosmos] elevate kwargs for sync client #34207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/cosmos/azure-cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#### Bugs Fixed

#### Other Changes
* Marked `computed_properties` keyword as provisional, un-marked `continuation_token_limit` as provisional. See [PR 34207](https://github.com/Azure/azure-sdk-for-python/pull/34207).

### 4.5.2b4 (2024-02-02)
This version and all future versions will require Python 3.8+.
Expand Down
9 changes: 4 additions & 5 deletions sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ async def read_item(
request_options = _build_options(kwargs)

request_options["partitionKey"] = await self._set_partition_key(partition_key)
max_integrated_cache_staleness_in_ms = kwargs.pop('max_integrated_cache_staleness_in_ms', None)
if max_integrated_cache_staleness_in_ms is not None:
validate_cache_staleness_value(max_integrated_cache_staleness_in_ms)
request_options["maxIntegratedCacheStaleness"] = max_integrated_cache_staleness_in_ms
Expand Down Expand Up @@ -369,6 +368,7 @@ def query_items(
initial_headers: Optional[Dict[str, str]] = None,
max_integrated_cache_staleness_in_ms: Optional[int] = None,
priority_level: Optional[Literal["High", "Low"]] = None,
continuation_token_limit: Optional[int] = None,
**kwargs: Any
) -> AsyncItemPaged[Dict[str, Any]]:
"""Return all results matching the given `query`.
Expand Down Expand Up @@ -397,9 +397,9 @@ def query_items(
:keyword dict[str, str] initial_headers: Initial headers to be sent as part of the request.
:keyword response_hook: A callable invoked with the response metadata.
:paramtype response_hook: Callable[[Dict[str, str], AsyncItemPaged[Dict[str, Any]]], None]
:keyword int continuation_token_limit: **provisional** The size limit in kb of the
response continuation token in the query response. Valid values are positive integers.
A value of 0 is the same as not passing a value (default no limit).
:keyword int continuation_token_limit: The size limit in kb of the response continuation token in the query
response. Valid values are positive integers.
A value of 0 is the same as not passing a value (default no limit).
:keyword int max_integrated_cache_staleness_in_ms: The max cache staleness for the integrated cache in
milliseconds. For accounts configured to use the integrated cache, using Session or Eventual consistency,
responses are guaranteed to be no staler than this value.
Expand Down Expand Up @@ -453,7 +453,6 @@ def query_items(
feed_options["maxIntegratedCacheStaleness"] = max_integrated_cache_staleness_in_ms
correlated_activity_id = GenerateGuidId()
feed_options["correlatedActivityId"] = correlated_activity_id
continuation_token_limit = kwargs.pop("continuation_token_limit", None)
if continuation_token_limit is not None:
feed_options["responseContinuationTokenLimitInKb"] = continuation_token_limit
if hasattr(response_hook, "clear"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def _build_auth(credential: CredentialType) -> CredentialDict:
"such as ClientSecretCredential).")
return auth


def _build_connection_policy(kwargs: Dict[str, Any]) -> ConnectionPolicy:
# pylint: disable=protected-access
policy = kwargs.pop('connection_policy', None) or ConnectionPolicy()
Expand Down
16 changes: 8 additions & 8 deletions sdk/cosmos/azure-cosmos/azure/cosmos/aio/_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ async def create_container(
has changed, and act according to the condition specified by the `match_condition` parameter.
:keyword match_condition: The match condition to use upon the etag.
:paramtype match_condition: ~azure.core.MatchConditions
:keyword List[Dict[str, str]] computed_properties: Sets The computed properties for this container in the Azure
Cosmos DB Service. For more Information on how to use computed properties visit
:keyword List[Dict[str, str]] computed_properties: **provisional** Sets The computed properties for this
container in the Azure Cosmos DB Service. For more Information on how to use computed properties visit
`here: https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/computed-properties?tabs=dotnet`
:keyword response_hook: A callable invoked with the response metadata.
:paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], None]
Expand Down Expand Up @@ -291,8 +291,8 @@ async def create_container_if_not_exists(
has changed, and act according to the condition specified by the `match_condition` parameter.
:keyword match_condition: The match condition to use upon the etag.
:paramtype match_condition: ~azure.core.MatchConditions
:keyword List[Dict[str, str]] computed_properties: Sets The computed properties for this container in the Azure
Cosmos DB Service. For more Information on how to use computed properties visit
:keyword List[Dict[str, str]] computed_properties: **provisional** Sets The computed properties for this
container in the Azure Cosmos DB Service. For more Information on how to use computed properties visit
`here: https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/computed-properties?tabs=dotnet`
:keyword response_hook: A callable invoked with the response metadata.
:paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], None]
Expand Down Expand Up @@ -479,14 +479,14 @@ async def replace_container(
:keyword match_condition: The match condition to use upon the etag.
:paramtype match_condition: ~azure.core.MatchConditions
:keyword dict[str, str] initial_headers: Initial headers to be sent as part of the request.
:keyword response_hook: A callable invoked with the response metadata.
:paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], None]
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: Raised if the container couldn't be replaced.
This includes if the container with given id does not exist.
:keyword int analytical_storage_ttl: Analytical store time to live (TTL) for items in the container. A value of
None leaves analytical storage off and a value of -1 turns analytical storage on with no TTL. Please
note that analytical storage can only be enabled on Synapse Link enabled accounts.
:keyword response_hook: A callable invoked with the response metadata.
:paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], None]
:returns: A `ContainerProxy` instance representing the container after replace completed.
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: Raised if the container couldn't be replaced.
This includes if the container with given id does not exist.
:rtype: ~azure.cosmos.aio.ContainerProxy

.. admonition:: Example:
Expand Down
8 changes: 4 additions & 4 deletions sdk/cosmos/azure-cosmos/azure/cosmos/aio/_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ class ScriptsProxy:
"""

def __init__(
self,
container: "ContainerProxy",
client_connection: _CosmosClientConnection,
container_link: str
self,
container: "ContainerProxy",
client_connection: _CosmosClientConnection,
container_link: str
) -> None:
self.client_connection = client_connection
self.container_link = container_link
Expand Down
Loading