Access azure blob storage files with python without downloading

Mata, Evan [USA] 6 Reputation points
2021-11-15T20:50:24.79+00:00

Is it possible to read the files from Azure blob storage into memory without downloading them? I'm specifically looking to do this via python. The general code I have is:

   from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient  
     
   container = ContainerClient.from_connection_string( <my connection str>, <my container name> )  
   blob_list = container.list_blobs()  
   for blob in blob_list:  
           blobClient = container.get_blob_client(blob)  
           <Goal: read file contents in here>  

Seems similar to https://learn.microsoft.com/en-us/answers/questions/49317/read-a-blob-directly-without-downloading-itpython.html, but this response downloads the files locally, which I do not want to do. My overall goal is to download / access the data from a Docker container I'll be deploying on ACI, I don't want to make the container too huge by downloading all the data.

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
757 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,192 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. deherman-MSFT 38,021 Reputation points Microsoft Employee Moderator
    2021-11-16T18:18:14.597+00:00

    @Mata, Evan [USA] The previous Q&A example you have given should allow you to read the block into a stream if you use the readinto(stream) option. See also this related StackOverflow thread which has some more helpful details.

    Hope this helps! Let me know if you are still having issues or need further assistance.

    -------------------------------

    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.