Re: [sqlalchemy] Session and optimistic disconnect handling

2021-06-10 Thread Mike Bayer
i think you need to turn on pool logging, echo_pool='debug'. Also note the "pre-ping" feature in some cases uses a "ping" feature provided by the DBAPI which can transparently reconnect (such as mysqlclient) so nothing would be seen there. On Thu, Jun 10, 2021, at 12:57 PM, 'Matt

Re: [sqlalchemy] Session and optimistic disconnect handling

2021-06-10 Thread 'Matt Zagrabelny' via sqlalchemy
On Tue, Jun 8, 2021 at 11:58 AM Mike Bayer wrote: > > Unknown network failures, I suppose. I have an application that is > throwing an exception right now due to: > > psycopg2.OperationalError: terminating connection due to administrator > command > SSL connection has been closed unexpectedly >

Re: [sqlalchemy] Session and optimistic disconnect handling

2021-06-08 Thread Mike Bayer
On Tue, Jun 8, 2021, at 12:40 PM, 'Matt Zagrabelny' via sqlalchemy wrote: > > > On Tue, Jun 8, 2021 at 10:28 AM Mike Bayer wrote: >> __ >> >>> however, I would advise using pool_pre_ping instead which is much easier to use and has basically no downsides.this feature didn't

Re: [sqlalchemy] Session and optimistic disconnect handling

2021-06-08 Thread 'Matt Zagrabelny' via sqlalchemy
On Tue, Jun 8, 2021 at 10:28 AM Mike Bayer wrote: > > > > however, I would advise using pool_pre_ping instead which is much easier > to use and has basically no downsides.this feature didn't exist when > the docs for "optimistic disconnect" were written. > > > Sure. I was only looking at

Re: [sqlalchemy] Session and optimistic disconnect handling

2021-06-08 Thread Mike Bayer
On Tue, Jun 8, 2021, at 11:18 AM, 'Matt Zagrabelny' via sqlalchemy wrote: > Hi Mike, > > Thanks for the reply! > > On Mon, Jun 7, 2021 at 6:08 PM Mike Bayer wrote: >> __ >> ORM Sessions ride on top of connections, but since the Session under it's >> default pattern of being bound to an

Re: [sqlalchemy] Session and optimistic disconnect handling

2021-06-08 Thread 'Matt Zagrabelny' via sqlalchemy
Hi Mike, Thanks for the reply! On Mon, Jun 7, 2021 at 6:08 PM Mike Bayer wrote: > ORM Sessions ride on top of connections, but since the Session under it's > default pattern of being bound to an Engine does the "connect" internally, > it's probably inconvenient to adapt the optimistic

Re: [sqlalchemy] Session and optimistic disconnect handling

2021-06-07 Thread Mike Bayer
ORM Sessions ride on top of connections, but since the Session under it's default pattern of being bound to an Engine does the "connect" internally, it's probably inconvenient to adapt the optimistic disconnect approach to it. You would probably want to bind the Session to the Connection

[sqlalchemy] Session and optimistic disconnect handling

2021-06-07 Thread 'Matt Zagrabelny' via sqlalchemy
Greetings SQLAlchemy folks, I am following the guide at [0] for recovering from a database error in my SQLAlchemy code. I normally use sessions for my SA work and am wondering if sessions will work with the aforementioned SA example. My initial attempt to combine the example at [0] with sessions