-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Added Samples for Feed Range APIs #45166
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?
Added Samples for Feed Range APIs #45166
Conversation
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 new Azure Cosmos DB Python SDK documentation and runnable samples demonstrating how to use feed range APIs for scoped operations (queries and change feed) and parallel processing patterns.
Changes:
- Added new sync and async samples covering core feed range scenarios (read/derive/compare feed ranges, feed-range-scoped queries, and change feed).
- Added new conceptual documentation page
FeedRanges.mddescribing feed ranges, when to use them, and the relevant APIs. - Updated the samples README to reference the new feed range sample.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| sdk/cosmos/azure-cosmos/samples/feed_range_management.py | New sync sample demonstrating feed range APIs and patterns. |
| sdk/cosmos/azure-cosmos/samples/feed_range_management_async.py | New async sample demonstrating feed range APIs and parallel processing with asyncio.gather(). |
| sdk/cosmos/azure-cosmos/samples/README.md | Adds an entry pointing to the new feed range sample. |
| sdk/cosmos/azure-cosmos/docs/FeedRanges.md | New conceptual + API reference doc for feed ranges (sync/async). |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Description
Adds comprehensive samples and documentation for the feed range APIs. Feed ranges enable sub-container-level operations such as parallel query processing, scoped change feed consumption, and workload distribution across workers.
What's included
New sample files:
Both samples demonstrate all public feed range APIs across 7 scenarios:
Reading feed ranges from a container (read_feed_ranges)
Converting a partition key to a feed range (feed_range_from_partition_key)
Checking feed range subset relationships (is_feed_range_subset)
Querying items scoped to individual feed ranges (query_items with feed_range)
Comparing feed range queries with partition key queries
Consuming change feed scoped to a feed range (query_items_change_feed with feed_range)
Parallel change feed processing by distributing feed ranges across workers
New documentation:
FeedRanges.md — Conceptual guide covering what feed ranges are, when to use them, API reference with sync/async code snippets, feed ranges vs partition keys comparison, and important considerations (opaque values, serialization, partition splits, mutual exclusivity)
Updated:
README.md — Added entry for the new feed range samples