You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use middleware and request state to bind a SQLAlchemy session to a request. Is there a way to inject the Request object from FastAPI in magic-di dependency chain?
The text was updated successfully, but these errors were encountered:
Hey 👋
magic-di dependencies are typically used in app scope. However, you can also combine them with fastapi’s request scope dependencies. Please correct me if I’m wrong, but I believe you can achieve it with something like this
Thanks! I'll make a try.
There's no real consensus to bind the SQLAlchemy to the request lifecycle. Folks are sometimes using middleware, or Depends mechanism.
Do you have a best practices to bind 1 session per Request or per celery task with magic-di?
Hi,
We use middleware and request state to bind a SQLAlchemy session to a request. Is there a way to inject the
Request
object from FastAPI inmagic-di
dependency chain?The text was updated successfully, but these errors were encountered: