Hopeit Engine Azure Blob Storage Toolkit
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hopeit_azure_blob_storage-0.1.0.tar.gz.
File metadata
- Download URL: hopeit_azure_blob_storage-0.1.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2a7265b43ce22fedff55c8d80bf19c50e9a83f60433ba420d070ada01797f52
|
|
| MD5 |
9550627cddd38f0e3673d2b52d7ed439
|
|
| BLAKE2b-256 |
faaf9c37a891996cfb51dd5380ac4872e8debdf132887ba37eeeeb03dba77c41
|
File details
Details for the file hopeit_azure_blob_storage-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hopeit_azure_blob_storage-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4344fa802ea46f7cac6163d6f62f3ac13916d52c1b9ec45b5623fa5c02c8d44e
|
|
| MD5 |
f487ec8ec3f73aceac068907dc87ffb8
|
|
| BLAKE2b-256 |
6c9c1c0dd1b0613a6c3912fccf6ac5323942f168da1d1489330fb68b09355a4b
|