StreamResponse Class
Wraps a streaming body for a User Data Function.
Constructor
StreamResponse(content: Iterable[bytes] | Iterator[bytes] | AsyncIterable[bytes] | AsyncIterator[bytes] | Iterable[str] | AsyncIterable[str], *, media_type: str = 'application/octet-stream', status_code: int = 200, headers: Mapping[str, str] | None = None)
Parameters
| Name | Description |
|---|---|
|
content
Required
|
An iterator/iterable (sync or async) yielding |
|
media_type
Required
|
The |
|
status_code
Required
|
The HTTP status code. Defaults to |
|
headers
Required
|
Optional extra response headers. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
media_type
|
Default value: application/octet-stream
|
|
status_code
|
Default value: 200
|
|
headers
|
Default value: None
|
Methods
| from_arrow_batches |
Build a StreamResponse that emits an Apache Arrow IPC stream incrementally, one record batch at a time, without buffering the whole table in memory. |
from_arrow_batches
Build a StreamResponse that emits an Apache Arrow IPC stream incrementally, one record batch at a time, without buffering the whole table in memory.
static from_arrow_batches(batches: Any, *, schema: Any = None, media_type: str = 'application/octet-stream', status_code: int = 200, headers: Mapping[str, str] | None = None) -> StreamResponse
Parameters
| Name | Description |
|---|---|
|
batches
Required
|
An iterable of |
|
schema
Required
|
The |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
schema
|
Default value: None
|
|
media_type
|
Default value: application/octet-stream
|
|
status_code
|
Default value: 200
|
|
headers
|
Default value: None
|