upd project structure
This commit is contained in:
1 parent
baa55d28d6
commit
1d162677a8
62 files changed
+1305
-48
No files matched your search
@@ -0,0 +1,19 @@
|
||||
from sqlmodel.ext.asyncio.session import AsyncSession
|
||||
from sqlalchemy.ext.asyncio import create_async_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from ..config import config
|
||||
|
||||
# import logging
|
||||
# logger = logging.getLogger('sqlalchemy.engine')
|
||||
# logger.setLevel(logging.DEBUG)
|
||||
|
||||
async_engine = create_async_engine(config.DATABASE_URI)
|
||||
async_session = sessionmaker[AsyncSession](
|
||||
async_engine, class_=AsyncSession, expire_on_commit=False
|
||||
)
|
||||
|
||||
|
||||
async def get_db() -> AsyncSession: # type: ignore
|
||||
async with async_session() as session:
|
||||
yield session
|
||||
Reference in new issue
Block a user