Hello Everyone,
We have application, while start up we initialize prepare engine args, configure orm. Once engine created we keep in session. Recently peer team introduced password rotation and for now as work around we are manually restarting the docker container to fetch latest password from secret client. I am trying to automate the process and implemented @event.listens_for(engine, "do_connect"). I have impression that every db connection will be fetched from pool and if pool exhausted or expired then we fetch new connection. But every time do_connect listener is called and it is taking 3-5 secs. For complex tasks it is taking long time. Can you please suggest best approach for password rotation? I tried below code, before password change I get this error "RecursionError: maximum recursion depth exceeded while calling a Python object"
@event.listens_for(engine, "do_connect")
try:
log.info("receive_do_connect success")
return engine.connect()
except SQLAlchemyError as err:
log.info("error receive_do_connect ")
<call secert client for latest password>
Regards,
Srinu