|
1 |
| -from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine |
2 |
| -from sqlalchemy.orm import sessionmaker |
| 1 | +# from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine |
| 2 | +# from sqlalchemy.orm import sessionmaker |
3 | 3 |
|
4 |
| -from core.settings import settings |
| 4 | +# from core.settings import settings |
5 | 5 |
|
6 |
| -engine = create_async_engine(settings.SQLALCHEMY_DATABASE_URI, echo = True) |
7 |
| -async_session = sessionmaker(engine, expire_on_commit=False, class_=AsyncSession) |
| 6 | +# engine = create_async_engine(settings.SQLALCHEMY_DATABASE_URI, echo = True) |
| 7 | +# async_session = sessionmaker(engine, expire_on_commit=False, class_=AsyncSession) |
8 | 8 |
|
9 | 9 |
|
10 |
| -# Postgres settings |
11 |
| -async def init_models(): |
12 |
| - async with engine.begin() as conn: |
13 |
| - # await conn.run_sync(Base.metadata.drop_all) |
14 |
| - await conn.run_sync(settings.Base.metadata.create_all) |
| 10 | +# # Postgres settings |
| 11 | +# async def init_models(): |
| 12 | +# async with engine.begin() as conn: |
| 13 | +# # await conn.run_sync(Base.metadata.drop_all) |
| 14 | +# await conn.run_sync(settings.Base.metadata.create_all) |
15 | 15 |
|
16 | 16 |
|
17 |
| -async def get_session() -> AsyncSession: |
18 |
| - async_session = sessionmaker( |
19 |
| - engine, class_=AsyncSession, expire_on_commit=False |
20 |
| - ) |
21 |
| - async with async_session() as session: |
22 |
| - yield session |
| 17 | +# async def get_session() -> AsyncSession: |
| 18 | +# async_session = sessionmaker( |
| 19 | +# engine, class_=AsyncSession, expire_on_commit=False |
| 20 | +# ) |
| 21 | +# async with async_session() as session: |
| 22 | +# yield session |
| 23 | + |
23 | 24 |
|
0 commit comments