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
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
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
>
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
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
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
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
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