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?
engine.urlreturns aURLobjectsqlalchemy.engine.url. As far as I can see, the Engine class (sqlalchemy.engine.Engine) has no property documented namedurl. The only thing I can see how to do is create an object when you already know the details of the connection. I'm trying to work out how to get that information back from anEngineinstance.Engineclass has aurlattribute (github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/engine/…) Looks like it's not documented