it looks like pyodbc has a timeout attribute on connection:
https://code.google.com/archive/p/pyodbc/wikis/Connection.wiki
but no init argument for that so youd need to use an event
engine = create_engine("mssql+pyodbc:// ...")
from sqlalchemy import event
@event.listens_for(engine, "connect")
Occasionally my Flask/WSGI application gets stuck while executing a query
against an SQL Server database. I have no control over that server, so
maybe I'll never be able to fix the issue, but at least I'd like to be able
to present my users with a meaningful error message rather than a "500