-
Notifications
You must be signed in to change notification settings - Fork 3k
Add feed_range in query_items
API
#41722
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
base: main
Are you sure you want to change the base?
Add feed_range in query_items
API
#41722
Conversation
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the new feed_range
parameter in the query_items
API, bringing Python in line with other SDKs, and updates several internal utilities for argument handling and exclusive-parameter validation.
- Introduced
feed_range
support in both sync and asyncquery_items
methods - Added
add_args_to_kwargs
andverify_exclusive_arguments
helpers and corresponding unit tests - Updated samples, tests, partition‐key logic, and overload signatures to integrate
feed_range
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
samples/examples.py / examples_async.py | Added code examples for feed_range queries (tags need fix) |
azure/cosmos/container.py | Wire in feed_range , drop legacy overloads, use new utils |
azure/cosmos/_utils.py | Added add_args_to_kwargs and verify_exclusive_arguments |
tests/test_utils.py | New unit tests for the helpers |
tests/test_query_feed_range*.py | End-to-end tests for sync/async feed-range queries |
other partition_key and connection code | Refactored _get_… APIs to get_… , new PartitionKeyKind/Version |
Comments suppressed due to low confidence (4)
sdk/cosmos/azure-cosmos/samples/examples_async.py:275
- The end marker here should match the start marker. Change
[END query_items_param]
to[END query_items_feed_range]
for consistency.
# [END query_items_param]
sdk/cosmos/azure-cosmos/samples/examples.py:152
- This end tag should match the corresponding start tag
[START query_items_feed_range]
. Rename it to[END query_items_feed_range]
.
# [END query_items_param]
sdk/cosmos/azure-cosmos/azure/cosmos/container.py:592
- The first overload definition doesn't include
feed_range
in its signature, which may confuse IDE users. You could add an overload that includesfeed_range
in the parameter list or adjust the existing overloads for consistency.
def query_items(
sdk/cosmos/azure-cosmos/azure/cosmos/container.py:863
- The code correctly prevents using
feed_range
andpartition_key
together, but there isn't an integration test for that error path. Consider adding a test that callsquery_items
with both parameters and asserts aValueError
.
utils.verify_exclusive_arguments(["feed_range", "partition_key"], **kwargs)
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
- Doc string updates - Tests were updated to use existing helper methods - Added tests with query_items with feed_range and partition_key
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
Description
Feed range is now available in the
query_items
API. Users can pass specific feed range to query items.Like other SDKs,
feed_range
cannot be used withpartition_key
. If both are used, an error will be raised.exmaple:
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines