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

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/3884b3c2-8814-494b-9d47-bc1304ab748cn%40googlegroups.com.

Reply via email to