dash add functionality to a database
Answers
Answered by
1
Answer:
@retry(wait=wait_exponential(multiplier=2, min=1, max=10), stop=stop_after_attempt(5))
def try_connection():
try:
with postgres_engine.connect() as connection:
stmt = text("SELECT 1")
connection.execute(stmt)
print("Connection to database successful.")
except Exception as e:
print("Connection to database failed, retrying.")
raise Exception
Explanation:This should work,hope you understood it.
Similar questions