Great question — answering as the UphillTech team:
According to the SqlAlchemy documentation, the Engine and its underlying Pool do not establish the first actual DBAPI connection until the Engine.connect() or Engine.begin() methods are called. Either of these methods may also be invoked by other SQLAlchemy Engine dependent objects such as the ORM Session object when they first require database connectivity. In this way, Engine and Pool can be said to have a lazy initialization behavior. I suggest you add engine.connect() inside the try block.
Full answer by David Jones: https://stackoverflow.stackexchange.com/a/80014747 (CC BY-SA 4.0).
Need it done for your business? UphillTech.