Skip to content

feat: Cosmos DB Change Feed Mode Support#346

Open
swapnil-nagar wants to merge 4 commits into
Azure:devfrom
swapnil-nagar:swapnil/CosmosDBUpdate-Python
Open

feat: Cosmos DB Change Feed Mode Support#346
swapnil-nagar wants to merge 4 commits into
Azure:devfrom
swapnil-nagar:swapnil/CosmosDBUpdate-Python

Conversation

@swapnil-nagar

@swapnil-nagar swapnil-nagar commented Jun 19, 2026

Copy link
Copy Markdown

Summary

Updated Python Azure Functions library to support Cosmos DB change feed modes (LatestVersion and AllVersionsAndDeletes), aligning with Azure WebJobs Extensions upstream implementation.

Changes

  • Type Definitions: Added CosmosDBChangeFeedMode type hint in _cosmosdb.py supporting 'LatestVersion' | 'AllVersionsAndDeletes'
  • Module Documentation: Updated CosmosDBConverter and CosmosDBTriggerConverter class docstrings to document change feed mode behavior
  • Public API: Exported CosmosDBChangeFeedMode type from main __init__.py for public consumption
  • Tests: Added 3 new unit tests validating change feed mode support:
    • test_cosmosdb_change_feed_mode_latest_version_support: Validates LatestVersion mode
    • test_cosmosdb_change_feed_mode_all_versions_and_deletes_support: Validates AllVersionsAndDeletes mode
    • test_cosmosdb_change_feed_mode_type_available: Verifies type availability in public API

Files Modified

  • azure/functions/_cosmosdb.py: Added CosmosDBChangeFeedMode type
  • azure/functions/cosmosdb.py: Updated documentation, exported type
  • azure/functions/__init__.py: Exported and documented CosmosDBChangeFeedMode
  • tests/test_cosmosdb.py: Added change feed mode tests

Alignment

This change mirrors the Node.js library v4.16.1 Cosmos DB updates, ensuring consistent change feed support across both runtimes.

- Added CosmosDBChangeFeedMode type supporting LatestVersion and AllVersionsAndDeletes modes
- Updated CosmosDBConverter and CosmosDBTriggerConverter documentation
- Exported CosmosDBChangeFeedMode from public API
- Added 3 unit tests for change feed mode support
- Updated version to 1.26.0
@swapnil-nagar swapnil-nagar changed the title Cosmos DB Change Feed Mode Support feat: Cosmos DB Change Feed Mode Support Jun 19, 2026
@swapnil-nagar

Copy link
Copy Markdown
Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 346 in repo Azure/azure-functions-python-library

Comment thread azure/functions/__init__.py Outdated
Comment thread azure/functions/cosmosdb.py
Comment thread azure/functions/_cosmosdb.py Outdated
@jviau

jviau commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

I am not familiar with E2E-test situation for this repo, but want to make sure the feature is validated either manually or by tests. A specific scenario to validate for is the incoming payload type when using AllVersionsAndDelete. With LatestVersion it will be T, for AVAD it will be ChangeFeedItem<T>. So the JSON representation of this CSharp class: https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.changefeeditem-1?view=azure-dotnet-preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants