-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yielding rows lazily #4
Comments
Could we pass
ResultSet impl that takes a Stream<Message> instead of List<Row> ? In that ResultSet , size() and updatedRows() would either have to block on completion of the streaming, or return some sort of future instead.
|
Hi, interesting idea. The library has no blocking methods, but a callback-based API (or future or promise) could be added. NettyPgProtocolStream currently passes the backend messages to PgConnection only after ReadyForQuery message is received, but there is no limitation why the rows could not be processed as soon as each individual row is available. The API could probably look something like Rx Observable with onNext/onComplete/onError (I'm planning on creating an Observable wrapper for the library as a separate project). Note that the implementation would not truly be lazy as the postgres backend always sends the entire result set (and cancelling is expensive as it opens a new physical connection), but the library could provide a Stream- or Observable-like API for consuming individual rows as early as possible. I'll take a look. Pull requests are also welcome. :) |
Cool. I'm a little tied-up with other work at the moment (and I don't write much Java) so I was thinking about tackling the smaller task of adding a manifold interface (as an alternative to the core.async interface) to postgres.async first, if you'd be interested in having that in the library? The two interfaces could live side-by-side. Here's manifold's rationale. If you haven't played with it yet, the new version of aleph has switched to a manifold interface and it's really nice to use. |
Manifold looks interesting. That interface could be included in postgres.async in a separate namespace and with provided scope manifold leiningen dependency. |
👍 for a manifold interface |
Hi, I am one of the developer of the Reactive support of Spring Framework. As part of the spring-reactive project, I am working on a spring-reactive-playground experiment which is about integrating MongoDB, Couchebase and PostgreSQL async drivers in order to have an example of a Reactive application end to end (web to database). Thanks a lot for your work on mongo-java-driver-reactivestreams, mongo-java-driver-rx or Couchbase AsyncN1qlQueryResult are good example of such API/implementation. Any thoughts? |
Hi, See queryRows: https://github.com/alaisi/postgres-async-driver/blob/master/src/main/java/com/github/pgasync/QueryExecutor.java @sdeleuze: This probably fits your use case perfectly? |
@alaisi Awesome, perfect match cf. sdeleuze/spring-reactive-playground@b90efcb Thanks! |
Hi Antti,
Thanks for this library. I was wondering if there are any plans to yield rows lazily? I see in
PgResultSet
thatiterator()
is currently backed by an eagerList<Row>
.Thanks!
Brian
The text was updated successfully, but these errors were encountered: