Azure Storage Blob ChangeFeed
raw JSON → 12.0.0b5 verified Fri May 01 auth: no python
Client library for consuming the Azure Blob Storage Change Feed. Provides a ChangeFeedClient to list and process events from the change feed. Currently at version 12.0.0b5 (beta), with an irregular release cadence. Requires azure-storage-blob as a peer dependency.
pip install azure-storage-blob-changefeed==12.0.0b5 Common errors
error ImportError: cannot import name 'ChangeFeedClient' from 'azure.storage.blob.changefeed' ↓
cause The module is not installed or pip package is missing.
fix
Install the package: pip install azure-storage-blob-changefeed==12.0.0b5
error AttributeError: 'ChangeFeedClient' object has no attribute 'list_changes' ↓
cause The method may have been renamed or the API changed between beta versions.
fix
Check documentation for the installed version: dir(change_feed_client) to see available methods.
error HttpResponseError: This operation is not supported for this storage account type ↓
cause The storage account does not have the change feed feature enabled or is not a general-purpose v2 or BlobStorage account.
fix
Enable change feed in the Azure portal under Data protection > Change feed. Ensure account type is StorageV2 or BlobStorage.
Warnings
deprecated The library is in beta (12.0.0b5) and the API may change. The ChangeFeedClient API has changed since early previews. ↓
fix Pin to the exact beta version and test upgrades carefully.
gotcha Requires azure-storage-blob >=12.x installed separately. It's not pulled automatically. ↓
fix Run: pip install azure-storage-blob
gotcha ChangeFeedClient expects a BlobServiceClient, not a connection string directly. Common mistake is to pass a connection string or BlobServiceClient from a different version. ↓
fix Create a BlobServiceClient first, then pass it to ChangeFeedClient.
Imports
- ChangeFeedClient wrong
from azure.storage.blob.changefeed import BlobChangeFeedClientcorrectfrom azure.storage.blob.changefeed import ChangeFeedClient
Quickstart
import os
from azure.storage.blob import BlobServiceClient
from azure.storage.blob.changefeed import ChangeFeedClient
from azure.identity import DefaultAzureCredential
account_url = os.environ.get('STORAGE_ACCOUNT_URL', 'https://mystorageaccount.blob.core.windows.net')
credential = DefaultAzureCredential()
blob_service_client = BlobServiceClient(account_url=account_url, credential=credential)
change_feed_client = ChangeFeedClient(blob_service_client=blob_service_client)
# List change feed events (iterates over all events from the beginning)
for event in change_feed_client.list_changes():
print(event.event_type, event.event_time)
# Process event
break