-
Notifications
You must be signed in to change notification settings - Fork 3k
Adding Throughput Bucket Header #40340
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
Changes from 16 commits
5fba97d
198e8ce
f810c42
4afa626
7362216
4f8aa50
ea44ada
88cbfd4
73b773f
419e374
7367548
d661dff
f8e3b3a
2864b4b
e05cb51
2dfd408
45d0540
a75b131
5de4f9e
b2c9a1f
8885a95
e96bc2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,6 +167,7 @@ class CosmosClient: # pylint: disable=client-accepts-api-version-keyword | |
level (to log all requests) or at a single request level. Requests will be logged at INFO level. | ||
:keyword bool no_response_on_write: Indicates whether service should be instructed to skip sending | ||
response payloads for write operations on items by default unless specified differently per operation. | ||
:keyword int throughput_bucket: The desired throughput bucket for the client | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The readme mentioned that the feature is in public preview? If that's the case, then everywhere this parameter is documented, it needs to be marked as provisional. |
||
|
||
.. admonition:: Example: | ||
|
||
|
@@ -251,6 +252,7 @@ async def create_database( | |
*, | ||
offer_throughput: Optional[Union[int, ThroughputProperties]] = None, | ||
initial_headers: Optional[Dict[str, str]] = None, | ||
throughput_bucket: Optional[int] = None, | ||
**kwargs: Any | ||
) -> DatabaseProxy: | ||
""" | ||
|
@@ -261,6 +263,7 @@ async def create_database( | |
:paramtype offer_throughput: Union[int, ~azure.cosmos.ThroughputProperties] | ||
: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. | ||
:keyword int throughput_bucket: The desired throughput bucket for the client | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be added to the per-method documentation that a value specified here will override any value already specified at the client-level. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also - it looks like this was maybe copy+pasted from the client-level documentation? This should be rephrased as it's not the bucket "for the client", rather it's the bucket "for the request" (or maybe "operation", as some of these, like query, are multiple requests). |
||
:paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], None] | ||
:raises ~azure.cosmos.exceptions.CosmosResourceExistsError: Database with the given ID already exists. | ||
:returns: A DatabaseProxy instance representing the new database. | ||
|
@@ -296,6 +299,8 @@ async def create_database( | |
DeprecationWarning) | ||
if initial_headers is not None: | ||
kwargs["initial_headers"] = initial_headers | ||
if throughput_bucket is not None: | ||
kwargs["throughput_bucket"] = throughput_bucket | ||
request_options = _build_options(kwargs) | ||
_set_throughput_options(offer=offer_throughput, request_options=request_options) | ||
|
||
|
@@ -309,6 +314,7 @@ async def create_database_if_not_exists( # pylint: disable=redefined-builtin | |
*, | ||
offer_throughput: Optional[Union[int, ThroughputProperties]] = None, | ||
initial_headers: Optional[Dict[str, str]] = None, | ||
throughput_bucket: Optional[int] = None, | ||
**kwargs: Any | ||
) -> DatabaseProxy: | ||
""" | ||
|
@@ -325,6 +331,7 @@ async def create_database_if_not_exists( # pylint: disable=redefined-builtin | |
:paramtype offer_throughput: Union[int, ~azure.cosmos.ThroughputProperties] | ||
: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. | ||
:keyword int throughput_bucket: The desired throughput bucket for the client | ||
:paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], None] | ||
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The database read or creation failed. | ||
:returns: A DatabaseProxy instance representing the database. | ||
|
@@ -348,6 +355,8 @@ async def create_database_if_not_exists( # pylint: disable=redefined-builtin | |
"The 'match_condition' flag does not apply to this method and is always ignored even if passed." | ||
" It will now be removed in the future.", | ||
DeprecationWarning) | ||
if throughput_bucket is not None: | ||
kwargs["throughput_bucket"] = throughput_bucket | ||
if initial_headers is not None: | ||
kwargs["initial_headers"] = initial_headers | ||
try: | ||
|
@@ -385,6 +394,7 @@ def list_databases( | |
max_item_count: Optional[int] = None, | ||
initial_headers: Optional[Dict[str, str]] = None, | ||
response_hook: Optional[Callable[[Mapping[str, Any]], None]] = None, | ||
throughput_bucket: Optional[int] = None, | ||
**kwargs: Any | ||
) -> AsyncItemPaged[Dict[str, Any]]: | ||
"""List the databases in a Cosmos DB SQL database account. | ||
|
@@ -393,6 +403,7 @@ def list_databases( | |
:keyword str session_token: Token for use with Session consistency. | ||
: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. | ||
:keyword int throughput_bucket: The desired throughput bucket for the client | ||
:paramtype response_hook: Callable[[Mapping[str, Any]], None] | ||
:returns: An AsyncItemPaged of database properties (dicts). | ||
:rtype: AsyncItemPaged[Dict[str, str]] | ||
|
@@ -405,6 +416,8 @@ def list_databases( | |
DeprecationWarning) | ||
if initial_headers is not None: | ||
kwargs["initial_headers"] = initial_headers | ||
if throughput_bucket is not None: | ||
kwargs["throughput_bucket"] = throughput_bucket | ||
feed_options = _build_options(kwargs) | ||
if max_item_count is not None: | ||
feed_options["maxItemCount"] = max_item_count | ||
|
@@ -423,6 +436,7 @@ def query_databases( | |
max_item_count: Optional[int] = None, | ||
initial_headers: Optional[Dict[str, str]] = None, | ||
response_hook: Optional[Callable[[Mapping[str, Any]], None]] = None, | ||
throughput_bucket: Optional[int] = None, | ||
**kwargs: Any | ||
) -> AsyncItemPaged[Dict[str, Any]]: | ||
"""Query the databases in a Cosmos DB SQL database account. | ||
|
@@ -435,6 +449,7 @@ def query_databases( | |
:keyword str session_token: Token for use with Session consistency. | ||
: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. | ||
:keyword int throughput_bucket: The desired throughput bucket for the client | ||
:paramtype response_hook: Callable[[Mapping[str, Any]], None] | ||
:returns: An AsyncItemPaged of database properties (dicts). | ||
:rtype: AsyncItemPaged[Dict[str, str]] | ||
|
@@ -447,6 +462,8 @@ def query_databases( | |
DeprecationWarning) | ||
if initial_headers is not None: | ||
kwargs["initial_headers"] = initial_headers | ||
if throughput_bucket is not None: | ||
andrewmathew1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
kwargs['throughput_bucket'] = throughput_bucket | ||
feed_options = _build_options(kwargs) | ||
if max_item_count is not None: | ||
feed_options["maxItemCount"] = max_item_count | ||
|
@@ -466,6 +483,7 @@ async def delete_database( | |
*, | ||
initial_headers: Optional[Dict[str, str]] = None, | ||
response_hook: Optional[Callable[[Mapping[str, Any]], None]] = None, | ||
throughput_bucket: Optional[int] = None, | ||
**kwargs: Any | ||
) -> None: | ||
"""Delete the database with the given ID (name). | ||
|
@@ -475,6 +493,7 @@ async def delete_database( | |
:type database: Union[str, ~azure.cosmos.DatabaseProxy, Dict[str, Any]] | ||
: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. | ||
:keyword int throughput_bucket: The desired throughput bucket for the client | ||
:paramtype response_hook: Callable[[Mapping[str, Any]], None] | ||
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: If the database couldn't be deleted. | ||
:rtype: None | ||
|
@@ -497,7 +516,8 @@ async def delete_database( | |
"The 'match_condition' flag does not apply to this method and is always ignored even if passed." | ||
" It will now be removed in the future.", | ||
DeprecationWarning) | ||
|
||
if throughput_bucket is not None: | ||
kwargs['throughput_bucket'] = throughput_bucket | ||
if initial_headers is not None: | ||
kwargs["initial_headers"] = initial_headers | ||
request_options = _build_options(kwargs) | ||
|
Uh oh!
There was an error while loading. Please reload this page.