Coverage for src/core/database.py: 100%

1 from advanced_alchemy.base import UUIDAuditBase

2 from litestar.plugins.sqlalchemy import SQLAlchemyAsyncConfig, SQLAlchemyPlugin

3 from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine

4

5 from .settings import settings

6

7 config = SQLAlchemyAsyncConfig(

8 connection_string=settings.db_url,

9 metadata=UUIDAuditBase.metadata,

10 # create_all=True,

11)

12 sqlalchemy_plugin = SQLAlchemyPlugin(config=config)

13

14

15 engine = create_async_engine(settings.db_url, echo=False)

16 session_maker = async_sessionmaker(engine, expire_on_commit=False, class_=AsyncSession)