Microsoft Azure Blob Storage Client Library for Python providing comprehensive APIs for blob storage operations.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Azure Blob Storage supports three blob types optimized for different scenarios, along with access tiers for cost optimization. Each blob type provides specific capabilities for different data patterns and use cases.
Azure Blob Storage provides three distinct blob types, each optimized for specific data access patterns and scenarios.
class BlobType:
"""Blob type enumeration."""
BLOCKBLOB: str # Optimized for streaming and storing cloud objects
PAGEBLOB: str # Optimized for random read/write operations
APPENDBLOB: str # Optimized for append operationsBlock blobs are optimized for streaming and storing cloud objects. They are ideal for documents, media files, backups, and general-purpose data storage.
Characteristics:
Use Cases:
Page blobs are optimized for random read and write operations. They serve as the backing storage for Azure Virtual Machine disks and support sparse data scenarios.
Characteristics:
Use Cases:
Append blobs are optimized for append operations, making them ideal for logging scenarios where data is continuously added.
Characteristics:
Use Cases:
Access tiers provide cost optimization by aligning storage costs with data access patterns. Different tiers offer trade-offs between storage cost and access cost.
Standard storage accounts support multiple access tiers for block blobs.
class StandardBlobTier:
"""Standard storage access tiers."""
HOT: str # Frequently accessed data
COOL: str # Infrequently accessed data (30+ days)
COLD: str # Rarely accessed data (90+ days)
ARCHIVE: str # Long-term archived data (180+ days)Hot Tier:
Cool Tier:
Cold Tier:
Archive Tier:
Premium storage accounts support performance tiers for page blobs, optimized for high IOPS and low latency scenarios.
class PremiumPageBlobTier:
"""Premium page blob performance tiers."""
P4: str # 25 IOPS per GiB
P6: str # 100 IOPS per GiB
P10: str # 500 IOPS per GiB
P15: str # 1,100 IOPS per GiB
P20: str # 2,300 IOPS per GiB
P30: str # 5,000 IOPS per GiB
P40: str # 7,500 IOPS per GiB
P50: str # 7,500 IOPS per GiB (larger size)
P60: str # 16,000 IOPS per GiBSet and modify access tiers for cost optimization and performance requirements.
# Set standard blob tier (available on BlobClient and ContainerClient)
def set_standard_blob_tier(self, standard_blob_tier, **kwargs) -> None:
"""
Set the access tier for a standard storage blob.
Args:
standard_blob_tier (StandardBlobTier): Target access tier
Optional Args:
rehydrate_priority (RehydratePriority, optional): Priority for archive rehydration
lease (BlobLeaseClient or str, optional): Required if blob has active lease
version_id (str, optional): Specific version to modify
"""
# Set premium page blob tier (available on BlobClient)
def set_premium_page_blob_tier(self, premium_page_blob_tier, **kwargs) -> None:
"""
Set the performance tier for a premium page blob.
Args:
premium_page_blob_tier (PremiumPageBlobTier): Target premium tier
Optional Args:
lease (BlobLeaseClient or str, optional): Required if blob has active lease
"""
# Batch tier operations (available on ContainerClient)
def set_standard_blob_tier_blobs(self, *blobs, **kwargs) -> Iterator[HttpResponse]:
"""
Set access tier for multiple standard blobs in batch.
Args:
*blobs: Tuples of (blob_name, standard_blob_tier) or BlobProperties with tier
Returns:
Iterator[HttpResponse]: Response for each tier operation
"""
def set_premium_page_blob_tier_blobs(self, *blobs, **kwargs) -> Iterator[HttpResponse]:
"""
Set performance tier for multiple premium page blobs in batch.
Args:
*blobs: Tuples of (blob_name, premium_page_blob_tier) or BlobProperties with tier
Returns:
Iterator[HttpResponse]: Response for each tier operation
"""When accessing archived blobs, they must be rehydrated to an online tier before access is possible.
class RehydratePriority:
"""Archive rehydration priority levels."""
Standard: str # Standard rehydration (up to 15 hours)
High: str # High priority rehydration (up to 1 hour)Rehydration Process:
# Rehydrate an archived blob to Hot tier with High priority
blob_client.set_standard_blob_tier(
StandardBlobTier.HOT,
rehydrate_priority=RehydratePriority.High
)
# Check rehydration status
properties = blob_client.get_blob_properties()
print(f"Archive Status: {properties.archive_status}")
print(f"Rehydrate Priority: {properties.rehydrate_priority}")Automate tier transitions using lifecycle management policies to optimize costs over time:
# Example: Blob properties show current tier and tier change time
properties = blob_client.get_blob_properties()
print(f"Current Tier: {properties.blob_tier}")
print(f"Tier Change Time: {properties.blob_tier_change_time}")
print(f"Tier Inferred: {properties.blob_tier_inferred}")Typical Lifecycle Pattern:
Multi-Tier Strategy:
Performance Tier Strategy:
Blob Type Strategy:
Install with Tessl CLI
npx tessl i tessl/pypi-azure-storage-blob