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] api review changes #31532

Merged
merged 2 commits into from
Aug 9, 2023
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 @@ -10,6 +10,7 @@
#### Bugs Fixed

#### Other Changes
* Renamed `response_continuation_token_limit_in_kb` to `continuation_token_limit` for GA. See [PR 31532](https://github.com/Azure/azure-sdk-for-python/pull/31532).

### 4.4.1b1 (2023-07-25)

Expand Down
8 changes: 4 additions & 4 deletions sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ 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 response_continuation_token_limit_in_kb: **provisional keyword** The size limit in kb of the
:keyword int continuation_token_limit: **provisional keyword** 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
Expand Down Expand Up @@ -369,9 +369,9 @@ def query_items(
feed_options["maxIntegratedCacheStaleness"] = max_integrated_cache_staleness_in_ms
correlated_activity_id = GenerateGuidId()
feed_options["correlatedActivityId"] = correlated_activity_id
response_continuation_token_limit_in_kb = kwargs.pop("response_continuation_token_limit_in_kb", None)
if response_continuation_token_limit_in_kb is not None:
feed_options["responseContinuationTokenLimitInKb"] = response_continuation_token_limit_in_kb
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"):
response_hook.clear()

Expand Down
8 changes: 4 additions & 4 deletions sdk/cosmos/azure-cosmos/azure/cosmos/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def query_items(
: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 Callable response_hook: A callable invoked with the response metadata.
:keyword int response_continuation_token_limit_in_kb: **provisional keyword** The size limit in kb of the
:keyword int continuation_token_limit: **provisional keyword** 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
Expand Down Expand Up @@ -399,9 +399,9 @@ def query_items(
feed_options["maxIntegratedCacheStaleness"] = max_integrated_cache_staleness_in_ms
correlated_activity_id = GenerateGuidId()
feed_options["correlatedActivityId"] = correlated_activity_id
response_continuation_token_limit_in_kb = kwargs.pop("response_continuation_token_limit_in_kb", None)
if response_continuation_token_limit_in_kb is not None:
feed_options["responseContinuationTokenLimitInKb"] = response_continuation_token_limit_in_kb
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"):
response_hook.clear()

Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmos/azure-cosmos/samples/document_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ def query_items_with_continuation_token_size_limit(container, doc_id):
sales_order = get_sales_order(doc_id)
container.create_item(body=sales_order)

# set response_continuation_token_limit_in_kb to 8 to limit size to 8KB
# set continuation_token_limit to 8 to limit size to 8KB
items = list(container.query_items(
query="SELECT * FROM r",
partition_key=doc_id,
response_continuation_token_limit_in_kb=size_limit_in_kb
continuation_token_limit=size_limit_in_kb
))

print('Continuation Token size has been limited to {}KB.'.format(size_limit_in_kb))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ async def query_items_with_continuation_token_size_limit(container, doc_id):
sales_order = get_sales_order(doc_id)
await container.create_item(body=sales_order)

# set response_continuation_token_limit_in_kb to 8 to limit size to 8KB
# set continuation_token_limit to 8 to limit size to 8KB
items = container.query_items(
query="SELECT * FROM r",
partition_key=doc_id,
response_continuation_token_limit_in_kb=size_limit_in_kb
continuation_token_limit=size_limit_in_kb
)

print('Continuation Token size has been limited to {}KB.'.format(size_limit_in_kb))
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmos/azure-cosmos/test/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ def test_continuation_token_size_limit_query(self):
container.create_item(body=dict(pk='123', id=str(i), some_value=str(i % 3)))
query = "Select * from c where c.some_value='2'"
response_query = container.query_items(query, partition_key='123', max_item_count=100,
response_continuation_token_limit_in_kb=1)
continuation_token_limit=1)
pager = response_query.by_page()
pager.next()
token = pager.continuation_token
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmos/azure-cosmos/test/test_query_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ async def test_continuation_token_size_limit_query(self):
await container.create_item(body=dict(pk='123', id=str(i), some_value=str(i % 3)))
query = "Select * from c where c.some_value='2'"
response_query = container.query_items(query, partition_key='123', max_item_count=100,
response_continuation_token_limit_in_kb=1)
continuation_token_limit=1)
pager = response_query.by_page()
await pager.__anext__()
token = pager.continuation_token
Expand Down