Skip to content
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

Support for async database access #251

Open
pschichtel opened this issue Dec 3, 2019 · 15 comments
Open

Support for async database access #251

pschichtel opened this issue Dec 3, 2019 · 15 comments
Labels

Comments

@pschichtel
Copy link
Contributor

I do understand that Anorm builds on top of JDBC which is inherently synchronous, just like most of the underlying drivers and protocols. However there are some databases that natively support asynchronous queries such as the postgresql and there are new database APIs like jasync-sql coming up that try to support this.
I like the simplicity Anorm, but I'd also like to use the asynchronous query support of the postgresql.

Are there any plans for supporting asychronous querying?

@cchantep
Copy link
Member

cchantep commented Dec 3, 2019

Hi, there is no such plan (and I doubt any would be able to keep Anorm simple design with such hybrid sync/async approach).

@pschichtel
Copy link
Contributor Author

I'm playing with the thought of forking anorm to see where I get by just replacing JDBC with e.g. jasync-sql and making the relevant APIs async.
Would you that this would be feasible?

@cchantep
Copy link
Member

cchantep commented Dec 4, 2019

There is a anorm-postgres for specific Postgres function, anyway Kotlin dependency won't be accepted for Anorm (jasync-sql).

@pschichtel
Copy link
Contributor Author

pschichtel commented Dec 4, 2019

I don't see how I could replace anorm's query handling just in the postgresql module and this wouldn't actually be postgresql specific (even though my specific use-cases involves that db). Also jasync-sql was just the first thing that came to my mind without looking more into it. There are other projects like e.g. R2DBC that implement async DB drivers in pure Java.

@cchantep
Copy link
Member

cchantep commented Dec 4, 2019

It's recommended to start with a specific case/DB, before thinking to generalize, to walk before running.

@pschichtel
Copy link
Contributor Author

Haven't worked on anything using Anorm for a while, however I helped a friend in implementing an anorm-inspired C# library, that is fully async. I might try to apply what we did there to an Anorm fork once I work on the project again, that needs this.

@feoktant
Copy link

@pschichtel have you looked at skunk project? It has similar idea with Anorm, but uses only Postgres in async way, without jdbc.

@pschichtel
Copy link
Contributor Author

I did not yet, but it looks interesting, thanks for the hint @feoktant

@simao
Copy link

simao commented Dec 29, 2021

You could try https://github.com/simao/anorm-async/

@cchantep
Copy link
Member

@simao Please avoid the confusing name anorm-async.

@simao
Copy link

simao commented Dec 29, 2021

@cchantep Ok, why is it confusing?

@cchantep
Copy link
Member

Even if anorm is not a registered name, naming a library not based on anorm named as anorm-* is indeed confusing.

@bursauxa
Copy link
Contributor

The second paragraph of the readme from anorm-async states:

anorm-async is a thin wrapper around anorm (...)

I have not looked at the code itself. @cchantep what makes you claim that it is in fact not based on anorm?

@cchantep
Copy link
Member

As far as I seen, there is no anorm import the Database so I can hardly see how it could be based on Anorm.

@simao
Copy link

simao commented Jan 20, 2022

I have changed the name of the project. Initially I had a different idea, but I ended up implementing something different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants