Chunks feature is not implemented in postgres.js, xata-http, pglite, neon-http, bun-sql
All other drivers have support for it
Chunks feature is not implemented in postgres.js, xata-http, pglite, neon-http, bun-sql
All other drivers have support for it
.chunked() lets you stream query result rows in chunks:
To enable streaming in chunks in node-postgres and other PostgreSQL drivers,
you need to install pg-query-stream and the query-stream extension that provides streaming support.
You can read more about extensions here
npm i pg-query-stream
import { queryStream } from 'waddler/extensions/pg-query-stream';
const sql = waddler(process.env.DATABASE_URL!, { extensions: [queryStream()] })const result = sql`select * from users`.chunked(2);
for await (const chunk of result) {
console.log(chunk);
}[
{
id: 1,
name: "Alex",
},
{
id: 2,
name: "Oleksii",
}
]
…