You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.
In addition to POST /ensembles/../records/../file, we should have a POST /ensembles/../records/../blob.
The file endpoint uses standard HTTP file uploading scheme by using the multipart/form-data. The user uploads a file named file, as if by using an HTML form like:
<inputtype="file" name="file" />
This has the benefit of being usable from Swagger, where it creates such an entry, but it has drawbacks, the largest of which is that it seems that FastAPI consumes the entire stream before the endpoint function is invoked. This leads to a substantial waiting time while the file is being uploaded to FastAPI, before it gets forwarded to blob storage.
The /blob endpoint, however, uses Starlette's Request class, which is represents the raw request. One of its functions is async def stream(self) -> AsyncGenerator[bytes, None]), which reads the stream in chunks, and allows us to send it further, without having to load the entire document as an intermediate step.
In addition to
POST /ensembles/../records/../file
, we should have aPOST /ensembles/../records/../blob
.The
file
endpoint uses standard HTTP file uploading scheme by using themultipart/form-data
. The user uploads a file namedfile
, as if by using an HTML form like:This has the benefit of being usable from Swagger, where it creates such an entry, but it has drawbacks, the largest of which is that it seems that FastAPI consumes the entire stream before the endpoint function is invoked. This leads to a substantial waiting time while the file is being uploaded to FastAPI, before it gets forwarded to blob storage.
The
/blob
endpoint, however, uses Starlette'sRequest
class, which is represents the raw request. One of its functions isasync def stream(self) -> AsyncGenerator[bytes, None])
, which reads the stream in chunks, and allows us to send it further, without having to load the entire document as an intermediate step.This is currently blocked by Azure Blob Storage not supporting async data uploads: Azure/azure-sdk-for-python#17478
The text was updated successfully, but these errors were encountered: