Spaces:
Runtime error

elshaddaioheha
feat(api): support supabase direct mode
00033cb
Raw History Blame Contribute Delete
581 Bytes
from __future__ import annotations
from collections.abc import AsyncIterator
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
from app.core.config import get_settings
from app.core.database_url import async_database_url
settings = get_settings()
engine = create_async_engine(async_database_url(settings.database_url), pool_pre_ping=True)
AsyncSessionLocal = async_sessionmaker(engine, expire_on_commit=False)
async def get_session() -> AsyncIterator[AsyncSession]:
async with AsyncSessionLocal() as session:
yield session