Skip to content

Added Samples for Feed Range APIs#45166

Merged
andrewmathew1 merged 8 commits into
Azure:mainfrom
andrewmathew1:users/andrewmathew1/feedrangeapisamples
Jul 8, 2026
Merged

Added Samples for Feed Range APIs#45166
andrewmathew1 merged 8 commits into
Azure:mainfrom
andrewmathew1:users/andrewmathew1/feedrangeapisamples

Conversation

@andrewmathew1

@andrewmathew1 andrewmathew1 commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

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:

  • feed_range_management.py — Sync sample
  • feed_range_management_async.py — Async sample with asyncio.gather() for concurrent processing

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.md describing 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).

Comment thread sdk/cosmos/azure-cosmos/docs/FeedRanges.md
Comment thread sdk/cosmos/azure-cosmos/samples/README.md
Comment thread sdk/cosmos/azure-cosmos/samples/feed_range_management.py Outdated
Comment thread sdk/cosmos/azure-cosmos/samples/feed_range_management_async.py Outdated
@andrewmathew1 andrewmathew1 changed the title Added Aamples for Feed Range APIs Added Samples for Feed Range APIs Feb 12, 2026
Andrew Mathew and others added 2 commits February 12, 2026 14:56

@simorenoh simorenoh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple comments, looks good otherwise - thanks!

Comment thread sdk/cosmos/azure-cosmos/docs/FeedRanges.md Outdated
Comment thread sdk/cosmos/azure-cosmos/docs/FeedRanges.md Outdated
Comment thread sdk/cosmos/azure-cosmos/docs/FeedRanges.md Outdated
Comment thread sdk/cosmos/azure-cosmos/samples/feed_range_management.py
Comment thread sdk/cosmos/azure-cosmos/samples/feed_range_management.py Outdated
Comment thread sdk/cosmos/azure-cosmos/docs/FeedRanges.md

@xinlian12 xinlian12 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@xinlian12 xinlian12 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

Comment thread sdk/cosmos/azure-cosmos/samples/feed_range_management.py
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Hi @andrewmathew1. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days.

@github-actions github-actions Bot added the no-recent-activity There has been no recent activity on this issue. label Jul 3, 2026
@github-actions github-actions Bot removed the no-recent-activity There has been no recent activity on this issue. label Jul 7, 2026
@andrewmathew1 andrewmathew1 merged commit 85e06fc into Azure:main Jul 8, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Cosmos] add comprehensive samples and documentation for feed range APIs and usage

4 participants