Get async session outside of route #161
Unanswered
breno-aumo
asked this question in
Q&A
Replies: 1 comment
-
I'm also interested in that. Can anyone share an example of how to do it? Thanks. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I followed the documentation (https://github.com/jolt-org/advanced-alchemy/blob/main/examples/fastapi.py) for building an async app.
This allows me to get access to the database in my routes using with
Depends(provide_db_session)
.For testing purposes, I want to be able to get a session outside of my routes. I should get an async session, perform some testing creations and deletions and exit. How can I get a session without a
Request
object?Beta Was this translation helpful? Give feedback.
All reactions