My first test and it's amazing
See original GitHub issueI did a little test with a application i have written in FastAPI using SQLAlchemy as ORM and the results are amazing:
The route code is the following:
@router.post('/sync_user')
async def sync_user(login: schemas.Login, db: Session = Depends(get_db)):
start = datetime.now()
if user := crud.login.get_by_email(db, login.email):
end = datetime.now()
duration = end - start
logger.info(f'Login Sync Duration: {duration.total_seconds()}')
return user
@router.post('/async_user')
async def async_user(login: schemas.Login, db: Session = Depends(get_db)):
start = datetime.now()
if user := await async_(crud.login.get_by_email)(db, login.email):
end = datetime.now()
duration = end - start
logger.info(f'Login Async Duration: {duration.total_seconds()}')
return user
Login Sync Duration: 0.015734 Login Async Duration: 0.002904
The results are outstanding
Really thanks for this. I’ll test more later this week.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
The 5 Best Pregnancy Tests of 2022 | Reviews by Wirecutter
The best home pregnancy test. The First Response Early Result wand test is the most sensitive home pregnancy test available in the US....
Read more >The 6 Best Pregnancy Tests of 2022 | by Verywell Family
The best pregnancy test is accurate, affordable, and easy to use. ... The First Response Early Results kit tops our list with reliable ......
Read more >What a Positive Pregnancy Test Really Looks Like
What a Positive Pregnancy Test Really Looks Like · The Test: First Response Early Response · The Test: EPT Pregnancy Test · The...
Read more >Best Pregnancy Tests to Take in 2022 - Babylist
If you just can't wait, the First Response Early Result test is what you want to grab. It's the most sensitive over-the-counter pregnancy...
Read more >Is Your Positive Pregnancy Test For Real? Find Out Now
First Response Early Result: First Response Early Result was rated as the best pregnancy test. because it was able to detect very low...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Right, so this does not give you any benefit, you are still blocking. Not sure why your timings say otherwise, but this project isn’t designed to help in your case. You shouldn’t be using SQLAlchemy in an asynchronous application.
The goal is to allow regular and async functions to call each other. There is nothing that makes blocking code non-blocking, at least nothing at this time.
Use cases: