Skip to content

Commit 51b9eab

Browse files
authored
[Cosmos] fixing bug with not passing kwargs/ response_hook in create_container_if_not_exists (#34286)
* fixes * Update CHANGELOG.md * fixed missing kwargs * using PR to remove these wrongly-marked limitations
1 parent 3e3d34b commit 51b9eab

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

sdk/cosmos/azure-cosmos/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#### Breaking Changes
88

99
#### Bugs Fixed
10+
* 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).
1011

1112
#### Other Changes
1213

sdk/cosmos/azure-cosmos/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,12 @@ Currently, the features below are **not supported**. For alternatives options, c
153153

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

sdk/cosmos/azure-cosmos/azure/cosmos/aio/_database.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ async def create_container_if_not_exists(
310310
analytical_storage_ttl = kwargs.pop("analytical_storage_ttl", None)
311311
offer_throughput = kwargs.pop('offer_throughput', None)
312312
computed_properties = kwargs.pop("computed_properties", None)
313+
etag = kwargs.pop("etag", None)
314+
match_condition = kwargs.pop("match_condition", None)
313315
try:
314316
container_proxy = self.get_container_client(id)
315317
await container_proxy.read(**kwargs)
@@ -324,7 +326,10 @@ async def create_container_if_not_exists(
324326
unique_key_policy=unique_key_policy,
325327
conflict_resolution_policy=conflict_resolution_policy,
326328
analytical_storage_ttl=analytical_storage_ttl,
327-
computed_properties=computed_properties
329+
computed_properties=computed_properties,
330+
etag=etag,
331+
match_condition=match_condition,
332+
**kwargs
328333
)
329334

330335
def get_container_client(self, container: Union[str, ContainerProxy, Dict[str, Any]]) -> ContainerProxy:

sdk/cosmos/azure-cosmos/azure/cosmos/database.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ def create_container_if_not_exists( # pylint:disable=docstring-missing-param
309309
"""
310310
analytical_storage_ttl = kwargs.pop("analytical_storage_ttl", None)
311311
computed_properties = kwargs.pop("computed_properties", None)
312+
etag = kwargs.pop("etag", None)
313+
match_condition = kwargs.pop("match_condition", None)
312314
try:
313315
container_proxy = self.get_container_client(id)
314316
container_proxy.read(
@@ -327,7 +329,10 @@ def create_container_if_not_exists( # pylint:disable=docstring-missing-param
327329
unique_key_policy=unique_key_policy,
328330
conflict_resolution_policy=conflict_resolution_policy,
329331
analytical_storage_ttl=analytical_storage_ttl,
330-
computed_properties=computed_properties
332+
computed_properties=computed_properties,
333+
etag=etag,
334+
match_condition=match_condition,
335+
**kwargs
331336
)
332337

333338
@distributed_trace

0 commit comments

Comments
 (0)