full-stack-fastapi-template
full-stack-fastapi-template copied to clipboard
Upgrade to SQLAlchemy 1.4 and convert endpoints to asyncio
- [x] Upgrade to SQLAlchemy 1.4, which supports AsyncIO. Full guide here.
- [x] Convert API endpoints to asyncio.
- [ ] Fix Celery.
Addresses: #315
@jianyuan This branch is an excellent reference!
Missed a couple in the start-up. async-startups-diff.txt
Celery doesn't yet have a way to queue tasks without blocking the asyncio loop or resorting to asgiref.sync_to_async. Maybe it should be skipped for this tutorial? arq would be a better choice.
As a warning for others, the sqlalchemy-stubs dev dependency is also not compatible with recent sqlalchemy - you will get errors in editors (vscode at the very least), though it will still run fine.
As a warning for others, the
sqlalchemy-stubsdev dependency is also not compatible with recentsqlalchemy- you will get errors in editors (vscodeat the very least), though it will still run fine.
I think it's compatible with SQLAlchemy, but Pyright doesn't make use of sqla mypy extension. If you want VS Code to show SQLAlchemy typing errors you're better off using the mypy extension for VS Code which has gotten better lately. I configured it and it works nicely, but I disabled default typing errors in VS Code.
Thanks @jianyuan! :bow:
I wanted to migrate to SQLModel, it was done in another PR, that is based on SQLAlchemy 2.0. :tada:
So, now I'll close this one, but thanks for all the effort! :cake:
@tiangolo , if you were even remotely grateful for the effort you would have signalled something before 3 YEARS after the PR. I know, you are busy, but there were plenty of people submitting PRs and presumably many who could have spent a little effort to keep things updated without you having to spend time. But no, a single (big name) maintainer who just ghosts everyone and their PRs for YEARS, then comes back as if it were last week...