Previously, and still in my personal projects, I have been a Django and Django ORM person.
I got away with by and large avoiding SQL statements in building web apps and have sometimes struggled to understand why SQL statements seemed much more forward-facing in SQLAlchemy in comparison.
Then I listened to your recent Talk Python podcast episode with M. Kennedy [1] and it helped me understand where the framework is coming from with regards to expectations for SQL capability from a developer that wants to use SQLAlchemy.
I believe the focus was much more so on the dark secrets you mention above, though and colored in how you discovered those.
If anyone wants to learn more about async or SQLAlchemy, I highly recommend listening.
As an aside, it was also cool to hear you talking about your project because for me, it humanized you as the maintainer. You sounded pretty chill, which was for some reason not what I was expecting.
I hope you can make it back on to that podcast with less of a gap between appearances next time.
> interface asyncio frontend and backend (like asyncpg for the driver) while maintaining all the "in the middle" code as synchronous style. the dark secret is that for this approach you have to use greenlet to propagate the "await" operations. It's been in our release for 18 months now with 1M downloads a day and there have been no problems reported with it, so i continue to wonder why nobody else seems to want to look at this approach.
do you have a blog post or some other kind of writeup to read about it? maybe nobody else had the same idea and it works so well nobody is aware that it can be done...
[0] https://forum.djangoproject.com/t/asynchronous-orm/5925/51
we at SQLAlchemy came up with a way to interface asyncio frontend and backend (like asyncpg for the driver) while maintaining all the "in the middle" code as synchronous style. the dark secret is that for this approach you have to use greenlet to propagate the "await" operations. It's been in our release for 18 months now with 1M downloads a day and there have been no problems reported with it, so i continue to wonder why nobody else seems to want to look at this approach. one downside which nobody has complained about yet is that it makes profiling tools like cProfile harder to use, but seems not to have come up yet.
there's also another approach, which is that you rewrite all your "in the middle" code as pure asyncio, then create a dummy task to implement your synchronous API. dark secret for that one is you had to rewrite everything and I'm not sure if there's other performance implications for having awaits all throughout code that's running only one task per thread.