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.
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_rangesupport in both sync and asyncquery_itemsmethods - Added
add_args_to_kwargsandverify_exclusive_argumentshelpers 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_rangein its signature, which may confuse IDE users. You could add an overload that includesfeed_rangein 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_rangeandpartition_keytogether, but there isn't an integration test for that error path. Consider adding a test that callsquery_itemswith 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). |
|
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). |
|
/azp run python - cosmos - tests |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
simorenoh
left a comment
There was a problem hiding this comment.
Just some comments, thanks!
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description
Feed range is now available in the
query_itemsAPI. Users can pass specific feed range to query items.Like other SDKs,
feed_rangecannot 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