LakeQL
Overview
  • Package Map
query-builder
  • Filtering
  • Sorting & Paging
  • API Reference
config
  • Runtime Config
  • API Reference
trino-client
  • Client Setup
  • Executing Queries
  • Streaming
  • Metadata
  • API Reference
fabric-client
  • Client Setup
  • Executing Queries
  • API Reference
GitHub
LakeQL
  1. Packages
  2. trino-client
  3. Streaming

Streaming

Stream large result sets one row at a time.

For large result sets, use stream. It returns an async generator that yields rows one at a time as pages are fetched, instead of buffering the whole result in memory.

1
2
3
4
5
6
7
8
const rows = await client.stream<{ id: number }>({
  sql: "SELECT id FROM hive.sales.orders",
})

for await (const row of rows) {
  process(row)
}

stream accepts the same options as query: transform, impersonateAs, and signal. Aborting the signal stops the generator and throws a TrinoCancellationError on the next pull.

Previous page

Executing Queries

Next page

Metadata