def write_to_blob()

in web-backend/backendUtils/blob_functions.py [0:0]


def write_to_blob(container_name, blob_path, data):
    """
    Write data to an Azure Blob Storage blob.
    
    Args:
        container_name (str): Name of the container
        blob_path (str): Path to the blob within the container
        data: Data to write to the blob
        
    Returns:
        None
        
    Raises:
        Exception: If there's an error writing to the blob
    """
    try:
        blob_client = blob_service_client.get_blob_client(container=container_name, blob=blob_path)
        blob_client.upload_blob(data, overwrite=True)
    except Exception as e:
        logging.error(f"Error writing to blob {blob_path} in container {container_name}: {str(e)}")
        raise