full-stack-fastapi-template icon indicating copy to clipboard operation
full-stack-fastapi-template copied to clipboard

Upgrade to SQLAlchemy 1.4 and convert endpoints to asyncio

Open jianyuan opened this issue 4 years ago • 5 comments

  • [x] Upgrade to SQLAlchemy 1.4, which supports AsyncIO. Full guide here.
  • [x] Convert API endpoints to asyncio.
  • [ ] Fix Celery.

Addresses: #315

jianyuan avatar Apr 03 '21 10:04 jianyuan

@jianyuan This branch is an excellent reference!

Andrew-Sheridan avatar May 10 '21 18:05 Andrew-Sheridan

Missed a couple in the start-up. async-startups-diff.txt

gmos avatar May 16 '21 15:05 gmos

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.

jokull avatar May 22 '21 11:05 jokull

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.

AntonOfTheWoods avatar Jul 17 '21 00:07 AntonOfTheWoods

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.

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.

jokull avatar Jul 17 '21 07:07 jokull

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 avatar Mar 08 '24 10:03 tiangolo

@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...

AntonOfTheWoods avatar Mar 08 '24 10:03 AntonOfTheWoods