Skip to content

Commit 0a1ad04

Browse files
andrewmathew1Andrew Mathew
and
Andrew Mathew
authored
got rid of container and database level requests (#40708)
Co-authored-by: Andrew Mathew <[email protected]>
1 parent aeb2e1a commit 0a1ad04

File tree

8 files changed

+157
-315
lines changed

8 files changed

+157
-315
lines changed

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

-4
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ async def read(
156156
populate_quota_info: Optional[bool] = None,
157157
priority: Optional[Literal["High", "Low"]] = None,
158158
initial_headers: Optional[Dict[str, str]] = None,
159-
throughput_bucket: Optional[int] = None,
160159
**kwargs: Any
161160
) -> Dict[str, Any]:
162161
"""Read the container properties.
@@ -170,7 +169,6 @@ async def read(
170169
:keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
171170
request. Once the user has reached their provisioned throughput, low priority requests are throttled
172171
before high priority requests start getting throttled. Feature must first be enabled at the account level.
173-
:keyword int throughput_bucket: The desired throughput bucket for the client
174172
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: Raised if the container couldn't be retrieved.
175173
This includes if the container does not exist.
176174
:returns: Dict representing the retrieved container.
@@ -187,8 +185,6 @@ async def read(
187185
kwargs['priority'] = priority
188186
if initial_headers is not None:
189187
kwargs['initial_headers'] = initial_headers
190-
if throughput_bucket is not None:
191-
kwargs["throughput_bucket"] = throughput_bucket
192188
request_options = _build_options(kwargs)
193189
if populate_partition_key_range_statistics is not None:
194190
request_options["populatePartitionKeyRangeStatistics"] = populate_partition_key_range_statistics

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

-27
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,13 @@ async def read(
131131
self,
132132
*,
133133
initial_headers: Optional[Dict[str, str]] = None,
134-
throughput_bucket: Optional[int] = None,
135134
**kwargs: Any
136135
) -> Dict[str, Any]:
137136
"""Read the database properties.
138137
139138
:keyword dict[str, str] initial_headers: Initial headers to be sent as part of the request.
140139
:keyword response_hook: A callable invoked with the response metadata.
141140
:paramtype response_hook: Callable[[Mapping[str, str], Dict[str, Any]], None]
142-
:keyword int throughput_bucket: The desired throughput bucket for the client
143141
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: If the given database couldn't be retrieved.
144142
:returns: A dict representing the database properties
145143
:rtype: Dict[str, Any]
@@ -154,8 +152,6 @@ async def read(
154152
database_link = _get_database_link(self)
155153
if initial_headers is not None:
156154
kwargs['initial_headers'] = initial_headers
157-
if throughput_bucket is not None:
158-
kwargs["throughput_bucket"] = throughput_bucket
159155
request_options = _build_options(kwargs)
160156

161157
self._properties = await self.client_connection.ReadDatabase(
@@ -181,7 +177,6 @@ async def create_container(
181177
vector_embedding_policy: Optional[Dict[str, Any]] = None,
182178
change_feed_policy: Optional[Dict[str, Any]] = None,
183179
full_text_policy: Optional[Dict[str, Any]] = None,
184-
throughput_bucket: Optional[int] = None,
185180
**kwargs: Any
186181
) -> ContainerProxy:
187182
"""Create a new container with the given ID (name).
@@ -215,7 +210,6 @@ async def create_container(
215210
:keyword Dict[str, Any] full_text_policy: **provisional** The full text policy for the container.
216211
Used to denote the default language to be used for all full text indexes, or to individually
217212
assign a language to each full text index path.
218-
:keyword int throughput_bucket: The desired throughput bucket for the client
219213
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The container creation failed.
220214
:returns: A `ContainerProxy` instance representing the new container.
221215
:rtype: ~azure.cosmos.aio.ContainerProxy
@@ -285,8 +279,6 @@ async def create_container(
285279
definition["fullTextPolicy"] = full_text_policy
286280
if initial_headers is not None:
287281
kwargs['initial_headers'] = initial_headers
288-
if throughput_bucket is not None:
289-
kwargs['throughput_bucket'] = throughput_bucket
290282
request_options = _build_options(kwargs)
291283
_set_throughput_options(offer=offer_throughput, request_options=request_options)
292284

@@ -312,7 +304,6 @@ async def create_container_if_not_exists(
312304
vector_embedding_policy: Optional[Dict[str, Any]] = None,
313305
change_feed_policy: Optional[Dict[str, Any]] = None,
314306
full_text_policy: Optional[Dict[str, Any]] = None,
315-
throughput_bucket: Optional[int] = None,
316307
**kwargs: Any
317308
) -> ContainerProxy:
318309
"""Create a container if it does not exist already.
@@ -348,7 +339,6 @@ async def create_container_if_not_exists(
348339
:keyword Dict[str, Any] full_text_policy: **provisional** The full text policy for the container.
349340
Used to denote the default language to be used for all full text indexes, or to individually
350341
assign a language to each full text index path.
351-
:keyword int throughput_bucket: The desired throughput bucket for the client
352342
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The container creation failed.
353343
:returns: A `ContainerProxy` instance representing the new container.
354344
:rtype: ~azure.cosmos.aio.ContainerProxy
@@ -393,7 +383,6 @@ async def create_container_if_not_exists(
393383
vector_embedding_policy=vector_embedding_policy,
394384
change_feed_policy=change_feed_policy,
395385
full_text_policy=full_text_policy,
396-
throughput_bucket=throughput_bucket,
397386
**kwargs
398387
)
399388

@@ -431,15 +420,13 @@ def list_containers(
431420
max_item_count: Optional[int] = None,
432421
initial_headers: Optional[Dict[str, str]] = None,
433422
response_hook: Optional[Callable[[Mapping[str, Any], AsyncItemPaged[Dict[str, Any]]], None]] = None,
434-
throughput_bucket: Optional[int] = None,
435423
**kwargs
436424
) -> AsyncItemPaged[Dict[str, Any]]:
437425
"""List the containers in the database.
438426
439427
:keyword int max_item_count: Max number of items to be returned in the enumeration operation.
440428
:keyword dict[str, str] initial_headers: Initial headers to be sent as part of the request.
441429
:keyword response_hook: A callable invoked with the response metadata.
442-
:keyword int throughput_bucket: The desired throughput bucket for the client
443430
:paramtype response_hook: Callable[[Mapping[str, Any], AsyncItemPaged[Dict[str, Any]]], None]
444431
:returns: An AsyncItemPaged of container properties (dicts).
445432
:rtype: AsyncItemPaged[Dict[str, Any]]
@@ -462,8 +449,6 @@ def list_containers(
462449
DeprecationWarning)
463450
if initial_headers is not None:
464451
kwargs['initial_headers'] = initial_headers
465-
if throughput_bucket is not None:
466-
kwargs["throughput_bucket"] = throughput_bucket
467452
feed_options = _build_options(kwargs)
468453
if max_item_count is not None:
469454
feed_options["maxItemCount"] = max_item_count
@@ -484,7 +469,6 @@ def query_containers(
484469
max_item_count: Optional[int] = None,
485470
initial_headers: Optional[Dict[str, str]] = None,
486471
response_hook: Optional[Callable[[Mapping[str, Any], AsyncItemPaged[Dict[str, Any]]], None]] = None,
487-
throughput_bucket: Optional[int] = None,
488472
**kwargs: Any
489473
) -> AsyncItemPaged[Dict[str, Any]]:
490474
"""List the properties for containers in the current database.
@@ -496,7 +480,6 @@ def query_containers(
496480
:keyword int max_item_count: Max number of items to be returned in the enumeration operation.
497481
:keyword dict[str, str] initial_headers: Initial headers to be sent as part of the request.
498482
:keyword response_hook: A callable invoked with the response metadata.
499-
:keyword int throughput_bucket: The desired throughput bucket for the client
500483
:paramtype response_hook: Callable[[Mapping[str, Any], AsyncItemPaged[Dict[str, Any]]], None]
501484
:returns: An AsyncItemPaged of container properties (dicts).
502485
:rtype: AsyncItemPaged[Dict[str, Any]]
@@ -509,8 +492,6 @@ def query_containers(
509492
DeprecationWarning)
510493
if initial_headers is not None:
511494
kwargs['initial_headers'] = initial_headers
512-
if throughput_bucket is not None:
513-
kwargs["throughput_bucket"] = throughput_bucket
514495
feed_options = _build_options(kwargs)
515496
if max_item_count is not None:
516497
feed_options["maxItemCount"] = max_item_count
@@ -538,7 +519,6 @@ async def replace_container(
538519
analytical_storage_ttl: Optional[int] = None,
539520
computed_properties: Optional[List[Dict[str, str]]] = None,
540521
full_text_policy: Optional[Dict[str, Any]] = None,
541-
throughput_bucket: Optional[int] = None,
542522
**kwargs: Any
543523
) -> ContainerProxy:
544524
"""Reset the properties of the container.
@@ -567,7 +547,6 @@ async def replace_container(
567547
:keyword Dict[str, Any] full_text_policy: **provisional** The full text policy for the container.
568548
Used to denote the default language to be used for all full text indexes, or to individually
569549
assign a language to each full text index path.
570-
:keyword int throughput_bucket: The desired throughput bucket for the client
571550
:returns: A `ContainerProxy` instance representing the container after replace completed.
572551
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: Raised if the container couldn't be replaced.
573552
This includes if the container with given id does not exist.
@@ -603,8 +582,6 @@ async def replace_container(
603582
DeprecationWarning)
604583
if initial_headers is not None:
605584
kwargs['initial_headers'] = initial_headers
606-
if throughput_bucket is not None:
607-
kwargs['throughput_bucket'] = throughput_bucket
608585
request_options = _build_options(kwargs)
609586

610587
container_id = self._get_container_id(container)
@@ -637,7 +614,6 @@ async def delete_container(
637614
container: Union[str, ContainerProxy, Mapping[str, Any]],
638615
*,
639616
initial_headers: Optional[Dict[str, str]] = None,
640-
throughput_bucket: Optional[int] = None,
641617
**kwargs: Any
642618
) -> None:
643619
"""Delete a container.
@@ -649,7 +625,6 @@ async def delete_container(
649625
:keyword dict[str, str] initial_headers: Initial headers to be sent as part of the request.
650626
:keyword response_hook: A callable invoked with the response metadata.
651627
:paramtype response_hook: Callable[[Mapping[str, str], None], None]
652-
:keyword int throughput_bucket: The desired throughput bucket for the client
653628
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: If the container couldn't be deleted.
654629
:rtype: None
655630
"""
@@ -673,8 +648,6 @@ async def delete_container(
673648
DeprecationWarning)
674649
if initial_headers is not None:
675650
kwargs['initial_headers'] = initial_headers
676-
if throughput_bucket is not None:
677-
kwargs['throughput_bucket'] = throughput_bucket
678651
request_options = _build_options(kwargs)
679652

680653
collection_link = self._get_container_link(container)

sdk/cosmos/azure-cosmos/azure/cosmos/container.py

-4
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ def read( # pylint:disable=docstring-missing-param
154154
*,
155155
priority: Optional[Literal["High", "Low"]] = None,
156156
initial_headers: Optional[Dict[str, str]] = None,
157-
throughput_bucket: Optional[int] = None,
158157
response_hook: Optional[Callable[[Mapping[str, str], Dict[str, Any]], None]] = None,
159158
**kwargs: Any
160159
) -> Dict[str, Any]:
@@ -170,7 +169,6 @@ def read( # pylint:disable=docstring-missing-param
170169
:keyword dict[str, str] initial_headers: Initial headers to be sent as part of the request.
171170
:keyword response_hook: A callable invoked with the response metadata.
172171
:paramtype response_hook: Callable[[Mapping[str, str], Dict[str, Any]], None]
173-
:keyword int throughput_bucket: The desired throughput bucket for the client
174172
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: Raised if the container couldn't be retrieved.
175173
This includes if the container does not exist.
176174
:returns: Dict representing the retrieved container.
@@ -186,8 +184,6 @@ def read( # pylint:disable=docstring-missing-param
186184
kwargs['priority'] = priority
187185
if initial_headers is not None:
188186
kwargs['initial_headers'] = initial_headers
189-
if throughput_bucket is not None:
190-
kwargs["throughput_bucket"] = throughput_bucket
191187
if response_hook is not None:
192188
kwargs['response_hook'] = response_hook
193189
request_options = build_options(kwargs)

0 commit comments

Comments
 (0)