[Cosmos] query_items with feed_range and continuation bug fix#43700
Merged
[Cosmos] query_items with feed_range and continuation bug fix#43700
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where queries using feed_range and continuation options would not work as expected. The fix ensures that when making internal calls to get_overlapping_ranges(), only the necessary partition key range options (specifically containerRID) are passed instead of the entire query options dictionary.
Key Changes
- Added a new utility function
format_pk_range_options()in_base.pyto extract only the relevant options for partition key range operations - Updated both sync and async query implementations to use this new function before calling
get_overlapping_ranges() - Updated CHANGELOG to properly categorize the merge support feature and document this bug fix
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
sdk/cosmos/azure-cosmos/azure/cosmos/_base.py |
Added format_pk_range_options() helper function to extract containerRID from query options |
sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_client_connection.py |
Updated to format options before calling get_overlapping_ranges() |
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_cosmos_client_connection_async.py |
Updated async version to format options before calling get_overlapping_ranges() |
sdk/cosmos/azure-cosmos/CHANGELOG.md |
Moved merge support entry to correct version and added bug fix entry |
tvaron3
reviewed
Oct 30, 2025
Member
Author
|
Follow-up tracking issue: #43706 |
Member
Author
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
JennyPng
pushed a commit
to JennyPng/azure-sdk-for-python
that referenced
this pull request
Nov 3, 2025
…43700) * changes, changelog * Update CHANGELOG.md * pylint, mypy, tests, samples, comments * move logic * Update _read_items_helper.py * forgot to actually move the logic * Update _base.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug with queries using both
feed_rangeandcontinuationoptions, where the continuation token for the query was being dragged into an internal SDK call to fetch PK ranges.This PR also adds additional samples on using feed_ranges along with queries. Follow-up has also been made to work on these more in depth: #43706