Re: [sqlalchemy] Update Username and Password from vault

2023-09-08 Thread Mike Bayer
makes sense, the connection is pooled. if you make lots of connections, like more than five simultaneous connections, you'd see more of it, if you call engine.dispose() then engine.connect(), you would see it again also, etc. Also try using NullPool, then you'd see the hook run every time

Re: [sqlalchemy] Update Username and Password from vault

2023-09-08 Thread Steven Schierholz
Yes but only once when the app starts up. On Friday, September 8, 2023 at 10:04:45 AM UTC-6 Mike Bayer wrote: > assuming proper indentation it looks fine. are your print statements > being seen ? > > On Fri, Sep 8, 2023, at 11:54 AM, Steven Schierholz wrote: > > Ok that makes sense and

Re: [sqlalchemy] Update Username and Password from vault

2023-09-08 Thread Mike Bayer
assuming proper indentation it looks fine. are your print statements being seen ? On Fri, Sep 8, 2023, at 11:54 AM, Steven Schierholz wrote: > Ok that makes sense and clarifies some stuff for me. I have tried your > implementation but it doesn't seem like its getting new connections. We are >

Re: [sqlalchemy] Update Username and Password from vault

2023-09-08 Thread Steven Schierholz
Ok that makes sense and clarifies some stuff for me. I have tried your implementation but it doesn't seem like its getting new connections. We are using sessionmaker(). So basically this is what we are doing. Can you help me understand if we are doing this right and if any changes need to

Re: [sqlalchemy] Update Username and Password from vault

2023-09-07 Thread Mike Bayer
no, create_engine() does not connect at all. connections occur when you first call `engine.connect()`. From that point, the behavior of subsequent `engine.connect()` calls depends on connection pool configuration. all connection pools have points at which they continue to establish new

Re: [sqlalchemy] Update Username and Password from vault

2023-09-07 Thread Steven Schierholz
That makes sense but doesn't connect only happen once when create_engine() is called? On Thursday, September 7, 2023 at 12:00:35 PM UTC-6 Mike Bayer wrote: > the documentation for this pattern is at > https://docs.sqlalchemy.org/en/20/core/engines.html#generating-dynamic-authentication-tokens

Re: [sqlalchemy] Update Username and Password from vault

2023-09-07 Thread Steven Schierholz
That makes sense but doesn't connect only happen once when create_engine() is called? On Thursday, September 7, 2023 at 12:00:35 PM UTC-6 Mike Bayer wrote: > the documentation for this pattern is at > https://docs.sqlalchemy.org/en/20/core/engines.html#generating-dynamic-authentication-tokens

Re: [sqlalchemy] Update Username and Password from vault

2023-09-07 Thread Mike Bayer
the documentation for this pattern is at https://docs.sqlalchemy.org/en/20/core/engines.html#generating-dynamic-authentication-tokens , and a completely specific example is at https://docs.sqlalchemy.org/en/20/dialects/mssql.html#mssql-pyodbc-access-tokens . Basically your application needs