【发布时间】:2021-08-26 08:26:28
【问题描述】:
我想读取一个巨大的 Azure blob 存储文件并将其内容流式传输到 Event-Hub。我找到了这个例子,
from azure.storage.blob import BlockBlobService
bb = BlockBlobService(account_name='', account_key='')
container_name = ""
blob_name_to_download = "test.txt"
file_path ="/home/Adam/Downloaded_test.txt"
bb.get_blob_to_path(container_name, blob_name_to_download, file_path, open_mode='wb',
snapshot=None, start_range=None, end_range=None, validate_content=False,
progress_callback=None, max_connections=2, lease_id=None,
if_modified_since=None, if_unmodified_since=None,
if_match=None, if_none_match=None, timeout=None)
但是通过这种方式,你不能在循环中获取块,这是我想做的。那么,如何针对我的案例修改此代码?
【问题讨论】:
-
我可以给你伪代码吗?
-
@GauravMantri 是的,当然。
-
请看下面我的回答。 HTH。
标签: python azure stream azure-blob-storage