StreamingResultReceiver¶
Receives results from a Session.stream() call. Unlike ResultReceiver
which buffers all rows before delivery, streaming delivers rows in
fixed-size batches as they arrive from the server.
The flow is pull-based: after each pg_stream_batch, call
session.fetch_more() to request the next batch. When the server has
no more rows, pg_stream_complete fires. Call session.close_stream()
to end streaming early.
Public Behaviours¶
pg_stream_batch¶
Called when a batch of rows is available. The batch size is at most the
window_size passed to session.stream(). After processing the batch,
call session.fetch_more() to request the next batch.
Parameters¶
pg_stream_complete¶
Called when all rows have been delivered and the streaming query is finished. No further batches will arrive.
Parameters¶
- session: Session tag
pg_stream_failed¶
Called when the streaming query fails. The failure is either a server
error (ErrorResponseMessage) or a client-side error (ClientQueryError)
such as the session being closed, not yet authenticated, or torn down
after a server protocol violation (ProtocolViolation).
be pg_stream_failed(
session: Session tag,
query: (PreparedQuery val | NamedPreparedQuery val),
failure: (ErrorResponseMessage val | ClientQueryError))
Parameters¶
- session: Session tag
- query: (PreparedQuery val | NamedPreparedQuery val)
- failure: (ErrorResponseMessage val | ClientQueryError)