-
-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Documentation for usage with async tools. Fixes #626 #633
base: main
Are you sure you want to change the base?
Conversation
📝 Docs preview for commit a5fe1d1 at: https://ececea1e.sqlmodel.pages.dev |
📝 Docs preview for commit b0081f5 at: https://049f644f.sqlmodel.pages.dev |
``` | ||
|
||
## Final code | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``` | |
```python |
``` | ||
pip install sqlmodel asyncpg fastapi uvicorn | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``` | |
pip install sqlmodel asyncpg fastapi uvicorn | |
``` | |
```bash | |
pip install sqlmodel asyncpg fastapi uvicorn |
) | ||
|
||
|
||
# Ayschronous Context manager for handling database sessions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Ayschronous Context manager for handling database sessions | |
# Asynchronous Context manager for handling database sessions |
@tiangolo , are you merging this in this century or next? |
@tiangolo Why don't you add the contribution? |
I have spent a good amount of time to figure out async implementation with SQLModel & FastAPI in one of our projects and thought this would be a helpful guide for anyone who is looking to do the same in their projects.
A simple working project is available here to test. Running the docker-compose will start the postgres with the required database: https://github.com/deshetti/sqlmodel-async-example