0

I'm using azure file storage for data persistence of several container instances, on that side, it is working fine. I issue I have is that some of the containers read data that I load manually to the File storage via web interface. I need to update this to be able to load the files from python but I'm not finding any examples of how to to this.

There is a github repo from Azure https://github.com/Azure/azure-storage-python that is supposed to handle that, but I'm not finding any examples there, only the source code. On medium and other sites I have found tutorials for using Blob but I haven't found any for Files

3

1 Answer 1

2

As the comment said, the samples show the action for the file share. I assume that you want to read the content from the file which in the file share, the same code below:

from azure.storage.file import FileService

storageAccount='xxxxx'
accountKey='xxxxx'

file_service = FileService(account_name=storageAccount, account_key=accountKey)

# if the file in the root path of the share, please let the directory name as ''
file = file_service.get_file_to_text(share_name, directory_name, file_name)
print(file.content)

This code gets the file with type File.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.