Skip to main content

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_mounting_helper_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(filepath1) # -> 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blob_mounting_helper_utility-1.0.3.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

blob_mounting_helper_utility-1.0.3-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file blob_mounting_helper_utility-1.0.3.tar.gz.

File metadata

File hashes

Hashes for blob_mounting_helper_utility-1.0.3.tar.gz
Algorithm Hash digest
SHA256 d9155e8635388430e154d564a54153553bdd828152ea89d75291d22f666aaf7c
MD5 77c07ee7ef5cecbe647c63bfc04d27d3
BLAKE2b-256 c8d86b46320dc1591836ef5890afd110d1e04739227f4c82524cc151ddeff18e

See more details on using hashes here.

File details

Details for the file blob_mounting_helper_utility-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for blob_mounting_helper_utility-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b6f76f987a946a4f360d80d332e34f48f6bf27c6a61a082323b5c7758a4fedb7
MD5 2e1d099e927bda19c5292ca95d2ce34a
BLAKE2b-256 6b4bd019c25c49144e18e24c25aa4e7d90b76c3fb6689ae7d054197d30d49646

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page