jonra1993 / fastapi-alembic-sqlmodel-async

This is a project template which uses FastAPI, Pydantic 2.0, Alembic and async SQLModel as ORM. It shows a complete async CRUD using authentication and role base access control.
MIT License
964 stars 150 forks source link

Calling postgres from celery #71

Open bazylhorsey opened 1 year ago

bazylhorsey commented 1 year ago

Right now we can use syncify with the CRUD functions inside celery, but aysncpg is still in charge of the session. This seems suboptimal but switching into psychopg seems like a lot of duplicated work? Is using asyncpg fine for this use-case?

jonra1993 commented 1 year ago

Hello @bazylhorsey thanks for your questions I also agree such operation is not the best for now and the cause is celery-sqlalchemy-scheduler which is online has sync support and it uses an old sqlalchemy implementation. I was thinking that in the future it could be a good idea to improve the implementation so it can support async. For now, using async is the best because the lib requires it.