Blob mapping utility for easy translation between azure urls and local paths
Project description
Blob mapping utility
When your code needs to access many mapped blobs as a mounted folder, the utility to make translation between blob urls and filepaths easier was made. It can be configured using the configuration json file.
Configuration file example:
{
"blob_mounting_configurations": [
{
"storage_account_name": "examplestagingstrgacc",
"storage_account_url": "https://examplestagingstrgacc.blob.core.windows.net/",
"container_name": "heightstore-example1-raw",
"mount_point": "/mnt/heightstore-example1-raw"
},
{
"storage_account_name": "examplestagingstrgacc",
"storage_account_url": "https://examplestagingstrgacc.blob.core.windows.net/",
"container_name": "heightstore-example2-raw",
"mount_point": "/mnt/heightstore-example2-raw"
},
{
"storage_account_name": "examplestagingstrgacc",
"storage_account_url": "https://examplestagingstrgacc.blob.core.windows.net/",
"container_name": "heightstore-example3-raw",
"mount_point": "/mnt/heightstore-example3-raw"
},
{
"storage_account_name": "examplestagingstrgacc",
"storage_account_url": "https://examplestagingstrgacc.blob.core.windows.net/",
"container_name": "example-container-raw",
"mount_point": "/mnt/example-container-raw"
}
]
}
How to use
from blob_mapping_utility import BlobMappingUtility
json_config_file = "blob_mapping_config.json"
# read the file into a dictionary
with open(json_config_file) as json_file:
config = json.load(json_file)["blob_mounting_configurations"]
# create the utility object
blob_mapping_utility = BlobMappingUtility(config)
filepath1 = "/mnt/example-container-raw/cool_picture.png
blob_url = blob_mapping_utility.get_url_from_mounted_filepath(mount_point) # -> https://examplestagingstrgacc.blob.core.windows.net/example-container-raw/cool_picture.png
filepath2 = get_mounted_filepath_from_url(blob_url) # -> /mnt/example-container-raw/cool_picture.png
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
Close
Hashes for blob_mounting_helper_utility-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4becfcaa4f6aee27f72709cf57415160fb345747943a791c5d892635739014f |
|
MD5 | 363c658951c2194b44b0f1fb848b727d |
|
BLAKE2b-256 | a0f0deea9ed5777f5ffbc5f71fb8bc48c6e489a4df289f092bbeae995b0f4302 |
Close
Hashes for blob_mounting_helper_utility-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bebd6220ea6f17ad5c0ebc64b79de4f4890167e5a5eb9dc4d1e28e7df7a9e3e |
|
MD5 | 0303f93c3e40b68de708f552b6eed082 |
|
BLAKE2b-256 | df6a07d73841c9bbf0d03c27128e8246d04ebcd7f2bb4a33bc99b2307d7be3e0 |