Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to modify specific blocks in an Azure Block Blob with the Python 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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading