How to modify specific blocks in an Azure Block Blob with the Python API?

Advertisements

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?

>Solution :

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.

Leave a ReplyCancel reply