pyGrowler / Growler

A micro web-framework using asyncio coroutines and chained middleware.
http://www.growler.rocks
Apache License 2.0
688 stars 29 forks source link

please suggest an ORM/db layer #2

Open sandys opened 8 years ago

sandys commented 8 years ago

coming from HN (https://news.ycombinator.com/item?id=11634152 and https://news.ycombinator.com/item?id=11632650)

Could you please include something like aiopg in your setup instructions - not as a requirement, but as a recommendation. Too many of us are using something like Flask with postgres and we would love to try Growler out.

But the world of Python ORMs is problematic when it comes to asyncio compatible libraries. This includes mysql, postgresql and redis - three of the biggest ones which pretty much everyone uses.

As someone else put it on HN - https://news.ycombinator.com/item?id=11629444

One problem with this is that the entire ecosystem has to get on board with async. Maybe a new framework would make it compelling enough, who knows. This was/is the big issue with Tornado, IMO (and Tornado has been around for ages in framework time). Tornado is only async if the entire call stack all the way down to the http socket is async, using callbacks instead of returning values. This means that any 3rd party client library you use has to be completely written asynchronously, and none are in python. So you end up with a lot tedious work re-implementing http client libraries for Twilio or Stripe or whatever you're using. I'm curious to see where asyncio goes in python, but I'm a bit skeptical after seeing how much of a pain it was to use Tornado on a large web app. In the meantime I'll be using Gevent + Flask, which isn't perfect since it adds some magic & complexity but has the huge upside of letting you keep using all the libraries you're used to.

jfmatth commented 8 years ago

Checkout peewee

sandys commented 8 years ago

I have checked out peewee, sqlalchemy async, psycopg, psycopg2, psycopg-cffi and aiopg (loosely based on psycopg).

I mention them, I'm sure there are going to be a lot more suggestions.

I'm looking for one that has been tested and validated as working with growler.

There always caveats with using databases with async frameworks - and I'm looking for the developer to.help me out here. For example sqlalchemy async will only operate in autocommit mode in async,etc. On May 6, 2016 01:29, "John Flynn Matthew" notifications@github.com wrote:

Checkout peewee project

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/pyGrowler/Growler/issues/2#issuecomment-217261367

foodaemon commented 8 years ago

For growler app talking to mongodb, you can checkout motor (http://motor.readthedocs.io/en/stable/) a db driver that supports non blocking async access. It's not an ORM though.

Kentoseth commented 7 years ago

Maybe this might help:

https://github.com/aio-libs

There seems to exist support for mysql, postgresql, couchdb, redis, etc.