loaders.azblobstorage
download_blob
def download_blob(connection_string: str, blobinfo: ObjectInfo) -> ObjectInfo
Downloads a blob from a specified Azure Blob Storage container and saves it to a target local file path.
This function uses the blob information provided in the blobinfo
object to locate and
process the specified blob. If the required directory path does not exist, it creates
the necessary directories before downloading the blob. Additionally, an empty file is written
in the target path within the Azure filesystem for compatibility purposes, if applicable.
Arguments:
connection_string
- The connection string for accessing the Azure Blob Storage account.blobinfo
- An ObjectInfo object containing details such as blob name, container name, Azure File System (abfs) file path, and the local mount file path.
Returns:
The same ObjectInfo object that was passed, providing blob-related metadata.
list_blobs
def list_blobs(connection_string: str,
container_name: str,
folder: str,
sourcefilter: str,
sourceorder: str,
include_subfolders: bool = False) -> Optional[List[ObjectInfo]]
List all blobs in the specified container. Filter on filter if exists :param connection_string: Connection string to the Azure Blob Storage account. :param container_name: Name of the container. :param sourcefilter: Filter to apply to the list of blobs. :include_subfolders: Subfolders included in the search.
normalize_path
def normalize_path(path)
Normalize path to always end with a single forward slash
apply_sourceorder
def apply_sourceorder(blobname: str, sourceorder: str)
Apply sourceorder to blobname to extract value from filename
Arguments:
blobname
str - Name of the blob/filesourceorder
str - Regular expression pattern with a capture group
Returns:
str
- Matched value from the capture group or empty string if no match