如何使用Python API修改Azure块Blob中的特定块?

huangapple go评论68阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年5月10日 17:22:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/76216794.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定