You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

11 lines
309 B

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