Documentation issue with Pessimistic Disconnect Handler Example

Issue #3712 resolved
Alexander Mohr created an issue

The example documented here: http://docs.sqlalchemy.org/en/latest/core/pooling.html#disconnect-handling-pessimistic has an issue in that it doesn't account for the connection.should_close_with_result status. If this is set it means that the select() will close the connection, causing the original request to work on a closed connection and failing. My trivial fix was to stash the state, set it to false, and then resolve after doing the select 1.

Comments (4)

  1. Mike Bayer repo owner

    this is part of the downstream version of this, I had omitted it to make the example easier to read. but it probably is better to have it here.

  2. Mike Bayer repo owner

    Add close_with_result to pessimistic connection example

    For connectionless execution, the recipe here will fail unless the should_close_with_result flag is temporarily set to False.

    Change-Id: Ib77b4439e8361b24478108c413b1ba720a68350f Fixes: #3712

    → <<cset 7f08d8c93af1>>

  3. Log in to comment