SqlIterator
- SqlIterator(
sql: string,
batchSize?: number,
sqlOptions?: Record<string, string>,
): AsyncGenerator<Record<string, any>, void, undefined>Parameters
- sql: string
The SQL statement to execute
- batchSize: number = 10000
Records to fetch per batch; defaults to 10000
- sqlOptions: Record<string, string> =
Options passed through to
/execute/sql
Returns AsyncGenerator<Record<string, any>, void, undefined>
Example
- Defined in src/GPUdb.ts:16103
- sql: string
Iterates the results of an SQL statement, fetching in batches.
Pages through the result set so arbitrarily large queries can be consumed without holding everything in memory at once, cleaning up any server-side paging tables when iteration finishes — including when the caller breaks out of the loop early.
Records are yielded as objects keyed by column name. This differs from the JavaScript API, which yields positional arrays; use
Object.values(record)if you need those.