Storage Explorer版本:1.14.2 内部编号:20200715.2 平台/操作系统:Windows 10 架构:ia32 回归自:不确定
大家好,
我已经创建了一个基于事件的触发器来触发某些管道。所以问题是当我尝试通过存储资源管理器手动将csv文件添加到指定的blob位置时,我的触发器运行正常,但是当像我这样的外部源有一个后端python代码将文件推入blob位置时,这是发生基于事件的触发器未触发。我只是检查了用于手动上传的内容类型,其内容类型为vnd.ms-excel,对于基于python代码的上传,其类型为八位字节流。问题是否与此或其他有关。我的Storage Explorer版本是1.14.2。
答案 0 :(得分:0)
请检查Python SDK的版本。
我正在使用Python v12 SDK将blob上传到Azure blob存储,并且效果很好。
这是我的python代码:
import os, uuid
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient, __version__
try:
print("Azure Blob storage v" + __version__ + " - Python quickstart sample")
# Quick start code goes here
# Create the BlobServiceClient object which will be used to create a container client
connect_str = os.getenv('AZURE_STORAGE_CONNECTION_STRING')
blob_service_client = BlobServiceClient.from_connection_string(connect_str)
# Get container
container_name = "test"
print(container_name)
# Create the container
container_client = blob_service_client.get_container_client(container_name)
# Create a file in local data directory to upload and download
local_path = "./data"
local_file_name = "Test.csv"
upload_file_path = os.path.join(local_path, local_file_name)
print(upload_file_path)
# Create a blob client using the local file name as the name for the blob
blob_client = blob_service_client.get_blob_client(container=container_name, blob=local_file_name)
print("\nUploading to Azure Storage as blob:\n\t" + local_file_name)
# Upload the file
with open(upload_file_path, "rb") as data:
blob_client.upload_blob(data)
except Exception as ex:
print('Exception:')
print(ex)
当我使用python将csv文件上传到Azure blob存储时,事件触发器触发了管道运行,并且运行良好: