postgres.async icon indicating copy to clipboard operation
postgres.async copied to clipboard

Query as a stream

Open donbonifacio opened this issue 10 years ago • 2 comments

Hello,

I think this is a feature request, because I did not find how to do it. I'd want to have a query delivered as a stream (for example, returning a channel that would be <! until closed. The use case is for example: Generate a report from a query that returns a huge amount of results, and not need to have it all in memory at the same time.

Btw, I did this with plain jdbc, but had other problems (can't get params like $1 to work, only ?), and would rather use this lib for this.

donbonifacio avatar Dec 16 '15 11:12 donbonifacio

Hi, does the query-rows fn in master fit your use case?

Sample usage:

(query-rows! db ["select generate_series(1, $1::int4) as i" 1000])

alaisi avatar Dec 19 '15 19:12 alaisi

Yes, that's great @alaisi :)

donbonifacio avatar Dec 21 '15 12:12 donbonifacio