Skip to content
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

[Cosmos] fixing bug with not passing kwargs/ response_hook in create_container_if_not_exists #34286

Merged
merged 4 commits into from
Mar 11, 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 @@ -7,6 +7,7 @@
#### Breaking Changes

#### Bugs Fixed
* Keyword arguments were not being passed down for `create_container_if_not_exists()` methods. See [PR 34286](https://github.com/Azure/azure-sdk-for-python/pull/34286).

#### 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).
Expand Down
3 changes: 0 additions & 3 deletions sdk/cosmos/azure-cosmos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,12 @@ Currently, the features below are **not supported**. For alternatives options, c

* Group By queries
* Queries with COUNT from a DISTINCT subquery: SELECT COUNT (1) FROM (SELECT DISTINCT C.ID FROM C)
* Transactional batch processing
* Direct TCP Mode access
* Continuation token support for aggregate cross-partition queries like sorting, counting, and distinct.
Streamable queries like `SELECT * FROM WHERE` *do* support continuation tokens.
* Change Feed: Processor
* Change Feed: Read multiple partitions key values
* Change Feed: Read specific time
* Change Feed: Read from the beginning
* Change Feed: Pull model
* Cross-partition ORDER BY for mixed types
* Enabling diagnostics for async query-type methods

Expand Down
7 changes: 6 additions & 1 deletion sdk/cosmos/azure-cosmos/azure/cosmos/aio/_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ async def create_container_if_not_exists(
analytical_storage_ttl = kwargs.pop("analytical_storage_ttl", None)
offer_throughput = kwargs.pop('offer_throughput', None)
computed_properties = kwargs.pop("computed_properties", None)
etag = kwargs.pop("etag", None)
match_condition = kwargs.pop("match_condition", None)
try:
container_proxy = self.get_container_client(id)
await container_proxy.read(**kwargs)
Expand All @@ -324,7 +326,10 @@ async def create_container_if_not_exists(
unique_key_policy=unique_key_policy,
conflict_resolution_policy=conflict_resolution_policy,
analytical_storage_ttl=analytical_storage_ttl,
computed_properties=computed_properties
computed_properties=computed_properties,
etag=etag,
match_condition=match_condition,
**kwargs
simorenoh marked this conversation as resolved.
Show resolved Hide resolved
)

def get_container_client(self, container: Union[str, ContainerProxy, Dict[str, Any]]) -> ContainerProxy:
Expand Down
7 changes: 6 additions & 1 deletion sdk/cosmos/azure-cosmos/azure/cosmos/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ def create_container_if_not_exists( # pylint:disable=docstring-missing-param
"""
analytical_storage_ttl = kwargs.pop("analytical_storage_ttl", None)
computed_properties = kwargs.pop("computed_properties", None)
etag = kwargs.pop("etag", None)
match_condition = kwargs.pop("match_condition", None)
try:
container_proxy = self.get_container_client(id)
container_proxy.read(
Expand All @@ -327,7 +329,10 @@ def create_container_if_not_exists( # pylint:disable=docstring-missing-param
unique_key_policy=unique_key_policy,
conflict_resolution_policy=conflict_resolution_policy,
analytical_storage_ttl=analytical_storage_ttl,
computed_properties=computed_properties
computed_properties=computed_properties,
etag=etag,
match_condition=match_condition,
**kwargs
)

@distributed_trace
Expand Down
Loading