docs: Added misc comments

This commit is contained in:
2026-06-29 17:52:25 +05:30
parent 40881b4773
commit 2e556173d4
4 changed files with 30 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ from typing import AsyncGenerator
from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker, AsyncSession
from app.core.config import settings
# Create async database engine
engine = create_async_engine(
settings.DATABASE_URL,
echo=False,
@@ -10,6 +11,7 @@ engine = create_async_engine(
max_overflow=20,
)
# Async session factory
AsyncSessionLocal = async_sessionmaker(
bind=engine,
class_=AsyncSession,
@@ -18,6 +20,7 @@ AsyncSessionLocal = async_sessionmaker(
async def get_db() -> AsyncGenerator[AsyncSession, None]:
"""Dependency for obtaining an asynchronous database session"""
async with AsyncSessionLocal() as session:
try:
yield session