Reputation: 389
I want to write APIs csv result to Azure BLOB Storage using python 3.7.
BLOB path: BLOB_ACCOUNT/CONTAINER_NAME/FOLDER_NAME/Files
I'm trying to write files into directory e.g. new files should be created into BLOB_ACCOUNT/CONTAINER_NAME/FOLDER_NAME/File1 BLOB_ACCOUNT/CONTAINER_NAME/FOLDER_NAME/File2 ..
I checked method of blob service, but not sure how to specify directory name to file path.
blob_service.put_block_blob_from_path(container_name, file_name, file_path)
Thank you for your help!
Upvotes: 0
Views: 1891
Reputation: 30025
The method put_block_blob_from_path
is very old and please upgrade your azure storage sdk to latest version(you can follow this and this article), and you should use
blobservice.create_blob_from_path
method in the latest sdk.
but not sure how to specify directory name to file path
the file name should be the directory_name/file_name, like FOLDER_NAME/File1. For example, I want to upload local file to storage_account/container_name/directory_name(eg. test1)/aa.txt, I can use the code below:
blobservice.create_blob_from_path("samples-workitems","test1/aa.txt","D:\\temp\\aa.txt")
Upvotes: 1