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

No examples on how to do async queries with flask #8

Open
pyrofolium opened this issue Jul 10, 2023 · 1 comment
Open

No examples on how to do async queries with flask #8

pyrofolium opened this issue Jul 10, 2023 · 1 comment

Comments

@pyrofolium
Copy link

There's no example on how to do async inserts and queries and transactions on flask. The read me has sync examples and I literally cannot find async anywhere. The example folder has stuff that's too complicated to make sense of.

Quart is primarily and async framework so it would be good to have minimal examples of all of the above.

@joeblackwaslike
Copy link
Owner

@pyrofolium I totally agree, thanks for pointing this out. This started as a simple translation of flask-sqlalchemy (branch main), after spending much time with quart it started to become painfully obvious that what worked for flask-sqlalchemy wasn't going to work for quart and the latest sqlalchemy (>= 2.x). Those old patterns don't hold anymore, especially in the age of all the new async frameworks.

So i built a minimal framework agnostic SQLAlchemy manager type object and included a quart extension adapter. This was designed ground-up to make working with multiple binds of different types (sync, async, read-only, read-write) seamless and do away with the magic that I feel is making the flask-sqlalchemy > quart-sqlalchemy conversion so painfully difficult. It's also much more straightforward to mock in pytest and utilize the rollback/savepoint nested transaction trick.

My strength is the technical stuff, I don't really know much about the doc frameworks like sphinx, but would love to one day. Maybe if I have some extra time this coming christmas break, I can make an attempt. But if you could add some, or anyone else can contribute this, I'd gladly review some async examples.

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

No branches or pull requests

2 participants