INNER CODE UNIT · Python

check_db_connection

asacristani/fastapi-rocket-boilerplate · app/main.py:58

def check_db_connection():
    try:
        with get_engine().connect():
            return True
    except OperationalError:
        return False


@app.get("/check_health", tags=["general"])
async def check_health():
    """
    Check all the services in the infrastructure are working
    """
    ok_code = "running"
    ko_code = "down"

    # DB check
    db_status = check_db_connection()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…