-
-
Notifications
You must be signed in to change notification settings - Fork 9k
'async_generator is not a callable object' dependency issue #3096
Copy link
Copy link
Closed
Labels
Description
The get_db dependency causes a weird
TypeError: <async_generator object get_db at 0x7ff6d9d9aa60> is not a callable object
issue on my project.
Here's my code:
db.py
from typing import Generator
from .db.session import SessionLocal
async def get_db() -> Generator:
try:
db = SessionLocal()
yield db
finally:
await db.close()
session.py
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
from .core.config import settings
engine = create_async_engine(
settings.SQLALCHEMY_DATABASE_URI,
pool_pre_ping=True
)
SessionLocal = AsyncSession(
autocommit=False,
autoflush=False,
bind=engine
)
Originally posted by @joweenflores in #2331 (comment)
Reactions are currently unavailable