Stream is not implemented in postgres.js
, xata-http
, pglite
, neon-http
, bun-sql
All other drivers have support for a stream feature
Stream is not implemented in postgres.js
, xata-http
, pglite
, neon-http
, bun-sql
All other drivers have support for a stream feature
.stream()
lets you stream query result rows one by one:
To enable streaming 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`.stream();
for await (const row of result) {
console.log(row);
}
{
id: 1,
name: "Alex",
}
{
id: 2,
name: "Oleksii",
}