Spaces:
Configuration error
Configuration error
File size: 564 Bytes
78013c4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from app.core.logging_config import get_logger
from prisma import Prisma
logger = get_logger("app.db")
db = Prisma()
async def connect_db() -> None:
try:
await db.connect()
logger.info("Connected to database")
except Exception as e:
logger.error("Failed to connect to database: %s", e, exc_info=True)
raise
async def disconnect_db() -> None:
try:
if db.is_connected():
await db.disconnect()
except Exception as e:
logger.error("Error disconnecting database: %s", e, exc_info=True)
|