hopeit.azure.blob-storage plugin
This library is part of hopeit.engine:
This library provides a ObjectStorage class to store and retrieve @dataobjects and files from Azure Blob Storage and compatible services as a plugin for the popular hopeit.engine reactive microservices framework.
It supports the prefix setting, which is a prefix to be used for every element (object or file) stored in the Azure Blob Storage bucket. This prefix can be used to organize and categorize stored data within the bucket. Additionally, it supports the partition_dateformat setting, which is a date format string used to prefix file names for partitioning saved files into different subfolders based on the event timestamp (event_ts()). For example, using %Y/%m/%d will store each data object in a folder structure like year/month/day/, providing a way to efficiently organize and retrieve data based on date ranges. These settings can be used together to achieve more granular organization of data within the bucket.
Installation
Python library that provides helpers to store and retrieve @dataobjects and files to Azure Blob Storage compatible services
pip install hopeit.azure.blob-storage
Usage
from hopeit.dataobjects import dataobject, dataclass
from hopeit.azure.blob_storage import ObjectStorage, ObjectStorageSettings, ConnectionConfig
# Set a connection configuration
conn_config = ConnectionConfig(
connection_string="__AZURE_CONNECTION_STRING__",
use_identity=False,
)
# Set settings for ObjectStorage
settings = ObjectStorageSettings(
bucket="your-bucket-name",
connection_config=conn_config
)
# Create an ObjectStorage instance
storage = await ObjectStorage.with_settings(settings).connect()
# hopeit.engine data object
@dataobject
@dataclass
class Something:
key: str
value: str
something = Something(key="my_key", value="some_value")
# Store a data object
await storage.store(key=something.key, value=something)
# Retrieve a data object
retrieved_object = await storage.get(key=something.key, datatype=Something)
print(retrieved_object)
Example Usage
In the apps/examples/azure-example/ directory, you can find a full example hopeit.engine app that demonstrates the usage of the hopeit.azure.blob-storage plugin within the hopeit.engine framework. This example showcases how to store and retrieve @dataobjects and files from Azure Blob Storage using the ObjectStorage class.
Metadata
Release files for hopeit.azure.blob-storage 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hopeit_azure_blob_storage-0.1.0.tar.gz | 8.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hopeit_azure_blob_storage-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.8 kB
Release files / hopeit_azure_blob_storage-0.1.0.tar.gz
| Download URL | hopeit_azure_blob_storage-0.1.0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2a7265b43ce22fedff55c8d80bf19c50e9a83f60433ba420d070ada01797f52
|
|
BLAKE2b-256 checksum How to use checksums |
faaf9c37a891996cfb51dd5380ac4872e8debdf132887ba37eeeeb03dba77c41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.9
|
Release files / hopeit_azure_blob_storage-0.1.0-py3-none-any.whl
| Download URL | hopeit_azure_blob_storage-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4344fa802ea46f7cac6163d6f62f3ac13916d52c1b9ec45b5623fa5c02c8d44e
|
|
BLAKE2b-256 checksum How to use checksums |
6c9c1c0dd1b0613a6c3912fccf6ac5323942f168da1d1489330fb68b09355a4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.9
|