下面是一个Python的示例代码,可以在VS Code中使用Azure Blob Storage SDK for Python找到指定路径下的BlobClient,并返回其名称:

from azure.storage.blob import BlobServiceClient

def get_blob_name(account_name, account_key, container_name, blob_path):
    blob_service_client = BlobServiceClient(account_url=f"https://{account_name}.blob.core.windows.net/", credential=account_key)
    container_client = blob_service_client.get_container_client(container_name)
    blob_client = container_client.get_blob_client(blob_path)
    return blob_client.blob_name

其中,account_name和account_key是你的Azure Blob Storage账户的名称和密钥,container_name是你的容器名称,blob_path是你要查找的Blob的相对路径。调用这个函数,它会返回找到的Blob的名称

在vscode中写函数找到数据湖中指定路径下的blobclient找到它的名字

原文地址: https://www.cveoy.top/t/topic/hljd 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录