英文:
How to modify specific blocks in an Azure Block Blob with the Python API?
问题
Azure文档关于块 Blob 的描述说明可以:
> 你可以通过插入、替换或删除现有的块来修改现有的块 Blob。
然而,查看 ContainerClient
类的 Python API 文档时,唯一相关的方法似乎是 ContainerClient.upload_blob
,看起来它似乎并没有提供通过块 ID 插入或替换块 Blob 中特定块的功能。
在Python SDK中,是否还有其他操作块 Blob 层面的方法,或者只能手动使用 REST API 完成这个操作?
英文:
The Azure documentation on block blobs describes that it is possible to:
> You can modify an existing block blob by inserting, replacing, or deleting existing blocks.
However, looking at the Python API documentation of the ContainerClient
class, the only related method seems to be ContainerClient.upload_blob
, and it doesn't look like it offers the functionality of inserting or replacing specific blocks inside a block blob via their block ID.
Is there any other way to operate on the block level of a block blob with the Python SDK, or is this only possible by using the REST API manually?
答案1
得分: 1
你所寻找的方法分别是stage_block
用于上传块,get_block_list
用于获取已上传块的列表,以及commit_block_list
用于提交块。这些方法在BlobClient
类中可用。
英文:
The methods you are looking for are stage_block
for uploading blocks, get_block_list
to get the list of blocks already uploaded and commit_block_list
to commit the blocks. These methods are available in BlobClient
class.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论