|
This FastAPI project generator generates a DAO for a dummy model with a useful FastAPI dependency of a DB session as an instance variable. def __init__(self, session: AsyncSession = Depends(get_db_session)):
self.session = sessionI am struggling to understand how to pass this over to a taskiq task so the task can write stuff to my app's database, as it (of course) is not serializable. |
Answered by
s3rius
Oct 1, 2023
Replies: 1 comment 4 replies
|
Just pass it as a dependency. Take a look at this docs page. If you used fastapi-template, then integration should be enabled, you just have to use |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Anyway. Try updating to https://github.com/taskiq-python/taskiq/releases/tag/0.9.2. This PR should fix these issues.