JetBrains / Exposed

Kotlin SQL Framework
http://jetbrains.github.io/Exposed/
Apache License 2.0
8.28k stars 690 forks source link

R2DBC support #456

Open NorbertSandor opened 5 years ago

NorbertSandor commented 5 years ago

Please make it possible to use https://github.com/r2dbc/r2dbc-client

NorbertSandor commented 5 years ago

A pluggable low-level database access layer would be even more better. It would be possible to support more "special" non-standard implementations like https://github.com/reactiverse/reactive-pg-client

mp911de commented 5 years ago

R2DBC support is built best on top of R2DBC SPI directly and not on R2DBC Client. R2DBC is for reactive programming what JDBC is for imperative programming. R2DBC can easily wrap less-capable asynchronous/non-blocking SQL database drivers exposing their functionality through a standardized SPI.

Javadoc: https://r2dbc.io/spec/0.8.0.M8/api/

sollecitom commented 4 years ago

Is this in progress? Would love to use Exposed if this was in.

ivseb commented 4 years ago

Any news? :)

taylancapraz commented 4 years ago

Are there any plan on this?

gytis-ivaskevicius commented 4 years ago

Alright its my time to shine. Ahem.

Any news on this?

Tapac commented 4 years ago

Hi everyone, I have a prove of concept implementation of RDBC driver support, BUT! RDBC api doesn't provide any methods to obtain database metadata like listing of database tables.

Right now I had decided to add ability to provide optional JDBC connection as a Database.connect parameter if you'd like to use some DDL.

It means that all DML operations will be handled by RDBC driver and all other with JDBC.

What do you think about it?

gytis-ivaskevicius commented 4 years ago

Brilliant news!!!

But here are a couple of things:

  1. Is metadata really necessary? If it is bearly used maybe it could be ignored or reimplemented? Probably tomorrow will check out how Exposed works more in detail. I kinda got curious
  2. Another option would be to manually implement it by executing a couple of database specific queries to retrieve required metadata. This would require more work but I feel like it is a better solution
Tapac commented 4 years ago

@WithoutCaps ,

  1. It could be ignored if you do not want to make any DDL queries and just work with existing schema (or manage it with something like Flyway or Liquibase`. That's why I made it optional to provide jdbc connection.

  2. Yep, I started with that apprach, but finished at the time I dig into H2 queries (inside H2 jdbc driver) for fetching column names of tables. As Exposed supports a lot of DBMS I can't spend so much time to support all of them also in that place. Jdbc drivers usually supported by database developers and they know when they should fix a query for a new DB version or how to optimize them. I don't :)

jvisker commented 4 years ago

@Tapac Are you planning on having people try out the proof of concept?

Tapac commented 4 years ago

@jvisker , yep. Have to add some tests and add documentation on how to use it. Hopefully I'll release it on the next week.

jvisker commented 4 years ago

Did I miss this release somehow?

Tapac commented 4 years ago

Nope, I just stuck with fixing all current tests with R2DBC driver. The tests with savepoints still fail, so I can't release it right now.

peterfigure commented 4 years ago

hi @Tapac - any news here?

dondish commented 3 years ago

Any updates?

cantaylancapraz commented 3 years ago

Is there an estimated completion date for this issue?

cantaylancapraz commented 3 years ago

Hi @Tapac

There is no update on this issue for a long time. Last information that we get about progress was in August 2020.

Could you please tell us whether this issue still on development or not? Or has it been postponed to the future?

Tapac commented 3 years ago

The work in progress, you can check rdbc-poc branch and try to build it localy. R2DBC connecion will require also jdbc connection for operations with Schemas as R2DBC doesn't provide any api for extracting metadata. The example of how to connect with R2DBC can be found in tests

sobvan commented 2 years ago

The work in progress, you can check rdbc-poc branch and try to build it localy. R2DBC connecion will require also jdbc connection for operations with Schemas as R2DBC doesn't provide any api for extracting metadata. The example of how to connect with R2DBC can be found in tests

Nice work @Tapac! When do you think this can be considered production ready? I am asking for Postgres specifically.

cantaylancapraz commented 2 years ago

The last commit seems to be 9 months ago. For this reason, I guess that this task will not be released in the near future, and its development is not continuing at the moment.

I wish there was an estimated time.

rustamch commented 2 years ago

The work in progress, you can check rdbc-poc branch and try to build it localy. R2DBC connecion will require also jdbc connection for operations with Schemas as R2DBC doesn't provide any api for extracting metadata. The example of how to connect with R2DBC can be found in tests

What needs to be done for this to be production ready?

FatalCatharsis commented 2 years ago

Not involved with the R2DBC project at all, but it looks like the R2DBC guys are waiting for expressed interest before implementing a DB introspection mechanism. For people that want to see this happen, I suggest upvoting https://github.com/r2dbc/r2dbc-spi/issues/203 .

@Tapac In the interim, would you accept a PR if someone continued the work of doing DB specific introspection for the places where it's needed or were you intending to resume this effort sooner than later?

Tapac commented 2 years ago

For now now I have uncompleted branch with R2DBC support with JDBC used for data introspection.

After recent updates in R2DBC API with tests doesn't pass and I'm not have enough time to debug the problem. I hope to finish the branch till the end of summer and maybe release it as an experimental module to get feedback.

FatalCatharsis commented 2 years ago

No problem, this is more of a wishlist item than a core feature I'd say and it's initial implementation will still be a blocking implementation that has to live in it's own threads for the time being. I took a stab at trying to update the framework to use suspend calls throughout but that is gonna be a downright massive effort. There are many places where properties are delegated by lazy to blocking calls and those would have to all be changed to suspend functions like from the metadata calls on Database. Lots and lots of refactoring. You also have the issue that converting much of the framework to suspend invocations will make it backwards incompatible.

If you have a plan though and can think of a way to break it down into individual efforts, I and others might have time to help you convert portions of it all to suspendable invocations so that eventually the framework is suspendable enough to share main worker threads in reactive frameworks like ktor and vertx.

aaronbond commented 2 years ago

any updates?

ghost commented 2 years ago

any updates?

I got a wife and 2 beautiful children

gytis-ivaskevicius commented 1 year ago

Code before family! :pleading_face: :heart:

cantaylancapraz commented 1 year ago

Is there an estimated completion time of this issue?

I apologize for asking this so many times. but we are at the point of switching to alternative solutions, even though I am very satisfied with exposed.

kampka commented 1 year ago

Hi @Tapac thanks for all your work that already went into this. If you find the time, could you possibly add a checklist of things left to do to get your branch through the door? Maybe we can crowd source the remaining effort.

micheljung commented 1 year ago

@Tapac asking again

micheljung commented 1 year ago

For me, this is - unfortunately - a reason to say goodbye to Exposed in favor of jOOQ which comes with coroutine support

ghost commented 1 year ago

For me, this is - unfortunately - a reason to say goodbye to Exposed in favor of jOOQ which comes with coroutine support

I encourage you and everyone else to give vertx.io a try; it is the best thing that JVM ecosystem has to offer.

raharrison commented 1 year ago

https://github.com/komapper/komapper is another alternative that is quite similar to Exposed to use and comes with both JDBC and R2DBC support

Intex32 commented 1 year ago

As JetBrains recently had a job posting for Exposed, I still haven't lost all my hope that this project will be resurrected and features like this finally tackled. Might take another two years though...

cantaylancapraz commented 9 months ago

Happy 5th birthday to this issue 🎉

hohohokekeke commented 3 months ago

Recently, is this issue working on? I can't wait any more. Should I find other library for using r2dbc?

dobe commented 3 months ago

Should I find other library for using r2dbc?

we use jooq, which works fine with r2dbc

tcrawford-figure commented 3 months ago

@hohohokekeke According to their most recent talk on Exploring the Exposed Library A Kotlin Solution to Database Access | Chantal Loncle, yes, this is in progress and part of the 2024 roadmap (but I assume that doesn't necessarily mean it will be released this year, just that it's in progress).