Spaces:
Sleeping
Sleeping
prepared statements issue
Browse files- src/app/database/db.py +4 -1
src/app/database/db.py
CHANGED
|
@@ -12,7 +12,10 @@ else:
|
|
| 12 |
elif DATABASE_URL.startswith("postgresql://") and "+asyncpg" not in DATABASE_URL:
|
| 13 |
DATABASE_URL = DATABASE_URL.replace("postgresql://", "postgresql+asyncpg://", 1)
|
| 14 |
|
| 15 |
-
engine = create_async_engine(
|
|
|
|
|
|
|
|
|
|
| 16 |
async_session_maker = async_sessionmaker(engine, class_=AsyncSession)
|
| 17 |
|
| 18 |
async def get_async_session() -> AsyncGenerator[AsyncSession, None]:
|
|
|
|
| 12 |
elif DATABASE_URL.startswith("postgresql://") and "+asyncpg" not in DATABASE_URL:
|
| 13 |
DATABASE_URL = DATABASE_URL.replace("postgresql://", "postgresql+asyncpg://", 1)
|
| 14 |
|
| 15 |
+
engine = create_async_engine(
|
| 16 |
+
DATABASE_URL,
|
| 17 |
+
connect_args={"prepared_statement_cache_size": 0},
|
| 18 |
+
)
|
| 19 |
async_session_maker = async_sessionmaker(engine, class_=AsyncSession)
|
| 20 |
|
| 21 |
async def get_async_session() -> AsyncGenerator[AsyncSession, None]:
|