from sqlalchemy import text from sqlalchemy.ext.asyncio import AsyncEngine async def ping_database(engine: AsyncEngine) -> bool: try: async with engine.connect() as connection: await connection.execute(text("SELECT 1")) return True except Exception: return False