IPWorks Cloud 2020 Python Edition

Questions / Feedback?

create_blob Method

Creates a new blob of the specified type.

Syntax

def create_blob(blob: str, blob_type: int, page_blob_size: int) -> None: ...

Remarks

This method creates a new blob named Blob in the container currently selected by container. BlobType specifies what type of blob should be created; valid values are: Possible values are:

abtBlockBlob (0) Block blob
abtPageBlob (1) Page blob
abtAppendBlob (2) Append blob

Refer to Azure's Understanding block blobs, append blobs, and page blobs article for more information about blob types.

PageBlobSize is only used when BlobType is abtPageBlob (1); it is ignored otherwise.

If the specified blob already exists, and is the same type of blob as BlobType specifies, then it will be overwritten if overwrite is enabled. However, any snapshots associated with the existing blob are retained.

If the specified blob already exists and has an active lease, its lease Id must be specified using lease_id, or the request will fail.

If the SendMetadata configuration setting is enabled when this method is called, all items in the Metadata* properties will be sent along with the creation request.

Creating Block Blobs

Block blobs can be created either with or without data initially. In either case, after the block blob is created, its contents can be managed by uploading blocks with put_block and then committing a new block list using put_block_list.

If upload data is present when this method is called to create a block blob, it will be uploaded in one of two ways. If the amount of data provided is less than or equal to the limit specified by the SimpleUploadLimit configuration setting (268435456 bytes (256MB), by default), it will be uploaded directly in the create blob request.

If more than SimpleUploadLimit bytes of data are provided, the class will first create the new block blob, and then upload the data by splitting it up into blocks (sized according to the FragmentSize configuration setting), uploading them individually, and then committing a new block list. To accomplish this, the class automatically makes calls to put_block and put_block_list internally, tracks the blocks as they are uploaded using the Block* properties, and tracks how much data has been uploaded using the start_byte property. The on_fragment_complete event will fire after each block is uploaded.

If, during a block-based upload, any individual put_block request (or the put_block_list request) fails, the upload can be resumed be calling this method again with the same parameters, so long as the Block* and start_byte properties still hold the same information as they did when the upload was interrupted.

When a block-based upload completes successfully, start_byte is reset to 0, but the Block* properties remains populated. This allows applications to easily inspect the Ids of the uploaded blocks, which the class generates automatically in the following GUID format: dddddddd-dddd-dddd-dddd-dddddddddddd (where each d is a single hex digit).

Creating Page Blobs

Unlike block blobs, no data can be uploaded when creating a page blob. However, the page blob's size (i.e., capacity) must be specified using PageBlobSize. A page blob's size must be a 512-byte-aligned; i.e. PageBlobSize % 512 == 0.

Once a page blob has been created, its contents can be manipulated using the put_pages and clear_pages methods.

Creating Append Blobs

Append blobs must also be created without uploading any data initially. After a page blob has been created, data can be appended to it using the append_block method.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 Python Edition - Version 20.0 [Build 8265]