-
Notifications
You must be signed in to change notification settings - Fork 53
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
postgres stream support #116
Comments
I implemented one of these methods myself now (in Kotlin returning a Flow), but the problem I ran into is that it is not very easy to have a query like
It would be nice if there was some easy way to turn a query into its respective prepared query and bind values, which would make it easier to implement streaming on our end for now but also make it more friendly to extension in general. Would be nice to get this in as a quick measure if you agree. |
I just looked into the unreleased 5.1.0 and it seems at least for some of the case I could now create a different solution so I would not need the protected methods. I will try and investigate all of our uses as soon as I have fully time for this. |
For the RX client/async client, I ended up writing methods like this, which I'm trying to decide how to integrate as a PR into the generated DAOs
I'd like to |
I am currently evaluating the implementation details. Because I had some questions of how to release all related resources in the right way, I've started a discussion in the vertx google group. Once this is sorted out I will start adding it to vertx-jooq (with a lag of one year 🕐 ). |
I added support for cursors and streams for the classic API. Unfortunately I wasn't able to finish the RX-API because of some errors I do not understand :D This is what I have for the classic API and here is how you would use it. Maybe @Globegitter or @Jotschi can help? Also any comments on the actual API are appreciated, if it is useful like that, etc. |
This is btw the error I get for the RX implementation:
|
I just figured out that there is an example in the vertx-docs of how to properly use the streaming-API together with RX-Java:
|
@jklingsporn I am wondering if you run in any problems with this. Using the above example I end up into the connection not being released to the pool. After all the pools are used (in my case I set it up to 5) everything just hangs as all the pools are being used ... |
You are right of course. I am now ended up with the following function and it seems to work (not sure about the onError-rollback-part):
|
@jklingsporn thanks for your reply .. I was just wondering, shouldn't the tx::commit part take care to release the connection back to the pool? I got very confused due to the lack of information on connection close/transaction commit from vertx documentation .. and therefore I am not sure if is indeed intended when using streams to close the connection explicitly. Do you think it might have any side effect? I tested on my environment and it seems it works (regarding the rollback I still have to test it) |
Maybe, but it doesn't. For example, there is a
It manually closes the connection in the end.
I agree, especially when they post incomplete examples (e.g. leaving out connection handling).
I don't think it has side-effects, because |
I decided to not add Cursor-Support for the RXJava-Api but only a
|
With the reactive/vertx sql client it is possible to stream results straight out of the database like so:
I guess API wise, the simplest way would be to extend the DAO with functions like
findManyByIdsStream(int fetch, Collection<T> ids)
and then it must return some kind of Stream.Being able to get a real stream straight out of the database has the potential to reduce memory usage and make things faster.
What do you think about that?
The text was updated successfully, but these errors were encountered: