Spaces:
Sleeping
Sleeping
simplify engine for direct connection
Browse files- src/app/database/db.py +2 -6
src/app/database/db.py
CHANGED
|
@@ -13,12 +13,8 @@ else:
|
|
| 13 |
elif DATABASE_URL.startswith("postgresql://") and "+asyncpg" not in DATABASE_URL:
|
| 14 |
DATABASE_URL = DATABASE_URL.replace("postgresql://", "postgresql+asyncpg://", 1)
|
| 15 |
|
| 16 |
-
engine = create_async_engine(
|
| 17 |
-
|
| 18 |
-
connect_args={"prepared_statement_cache_size": 0},
|
| 19 |
-
poolclass=NullPool,
|
| 20 |
-
isolation_level="AUTOCOMMIT",
|
| 21 |
-
)
|
| 22 |
|
| 23 |
async_session_maker = async_sessionmaker(engine, class_=AsyncSession)
|
| 24 |
|
|
|
|
| 13 |
elif DATABASE_URL.startswith("postgresql://") and "+asyncpg" not in DATABASE_URL:
|
| 14 |
DATABASE_URL = DATABASE_URL.replace("postgresql://", "postgresql+asyncpg://", 1)
|
| 15 |
|
| 16 |
+
engine = create_async_engine(DATABASE_URL)
|
| 17 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
async_session_maker = async_sessionmaker(engine, class_=AsyncSession)
|
| 20 |
|