How can I get a connection URL from an SQLAlchemy Engine instance?
问题 I begin a program by generating a URL object and passing it to create_engine. In a section of code far, far away I would like to find out what this engine is connected to, i.e. the connection URL. Is there an easy way to do this? Using inspect I can only see how to get the driver type. I can understand if the password component of a connection string was no longer available, but I'm hoping everything else is still available. Any ideas? 回答1: This works quite well for me: log.info("* Using DB: