question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blob Storage: Support AsyncIterable blob uploads

See original GitHub issue

Is your feature request related to a problem? Please describe. Currently, azure.storage.blob.aio.BlobClient’s upload_blob (as well as stage_blob etc), don’t support data that is AsyncIterable. That is the following will not work:

async def iterator() -> AsyncGenerator[bytes, None]:
    for i in range(10):
        yield str(i).encode("latin1")
        await asyncio.sleep(0.1)

await blob_client.upload_blob(iterator())

Describe the solution you’d like I’d like the aio versions of the upload functions to accept AsyncIterable[AnyStr] in addition to Iterable[AnyStr] and IO[AnyStr].

Describe alternatives you’ve considered Using intermediate pipes, creating a stream that we would feed manually. All alternatives do blocking and that doesn’t fit in the asyncio model.

Additional context Trying to have Starlette forward some data to blob storage, by using starlette.request.Request’s stream() async generator, so as to not load the entire document into memory.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jalauzon-msftcommented, Nov 16, 2022

Hi @Krande and @pinkwah, I have finally opened #27518 to add support for AsyncIterable to blob upload. Once this is merged, it will be part of our next release (no ETA on that currently). Thanks for your patience!

1reaction
xiafu-msftcommented, Apr 10, 2021

Hi @dotfloat Thanks for the feedback we will support this in the future release!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upload a blob using .NET - Azure Storage - Microsoft Learn
Learn how to upload a blob to your Azure Storage account using the .NET client library.
Read more >
@azure/storage-blob - npm
The Azure Blob Storage service supports the use of Azure Active Directory ... Create a blob by uploading data; List blobs inside a...
Read more >
Uploading async to Azure Blob Storage never returns
I'm trying to use the async methods to upload a file to Azure blob storage and then set its metadata, but the UploadFromByteArrayAsync...
Read more >
Example GitHub action to upload file(s) to Azure Blob Storage
Then, configure credentials that can write Azure Storage containers and blobs, like a service principal with the "Storage Blob Data Contributor" role. az...
Read more >
File upload to Azure blob storage - Appian Community
Azure blob storage provides an extensive Web API support. I suggest to read the documentation, do some R&D and come back with more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found