Python continues to get better async support and with that comes pressure to switch. See the realistic effects that switching to async would have on your web servers.
@hackeryarn It’s not clear from this writeup how SQLAlchemy is set up. If you’re using a sync postgres driver then you’re doing async-to-sync in your code and not testing what you think you’re testing.
A test of different async SQLAlchemy configurations would be helpful next to this. Including testing that the SQLAlchemy setup is async all the way through.
It is using the async driver. I am using FastAPI’s thin wrapper around SQLAlchemy which also does some slight tuning for it to work better with FastAPI in an async mode.
SQLAlchemy AsyncSession calls greenlet_spawn which wraps a Session sync method. For async dialect+driver, the sqlalchemy dbapi driver will make async connections.
Hey lets make an async call. You mean rewrite the exact code except with dispersed await sprinkled about? Fuck that! Once is enough. Instead wrap the sync call in a greenlet_spawn. And then return to the gulag of static type checking hell forever.
So is it async all the way thru? No. It’s async enough™
@hackeryarn It’s not clear from this writeup how SQLAlchemy is set up. If you’re using a sync postgres driver then you’re doing async-to-sync in your code and not testing what you think you’re testing.
A test of different async SQLAlchemy configurations would be helpful next to this. Including testing that the SQLAlchemy setup is async all the way through.
It is using the async driver. I am using FastAPI’s thin wrapper around SQLAlchemy which also does some slight tuning for it to work better with FastAPI in an async mode.
I live and breathe this stuff
SQLAlchemy AsyncSession calls greenlet_spawn which wraps a Session sync method. For async dialect+driver, the sqlalchemy dbapi driver will make async connections.
Hey lets make an async call. You mean rewrite the exact code except with dispersed await sprinkled about? Fuck that! Once is enough. Instead wrap the sync call in a greenlet_spawn. And then return to the gulag of static type checking hell forever.
So is it async all the way thru? No. It’s async enough™