the Session doesn't pull the connection from the engine until you do a
query or call session.connection(), session.execute(), etc. This is
because the Session supports multiple engines simultaenously and it
doesn't know which one to use until it's asked to query something.

On Tue, Jul 11, 2017 at 11:33 AM, Jonathan Vanasco
<jonat...@findmeon.com> wrote:
>
>
> On Tuesday, July 11, 2017 at 10:27:15 AM UTC-4, Mike Bayer wrote:
>>
>> So the note for this is at:
>>
>>
>> http://docs.sqlalchemy.org/en/latest/changelog/migration_12.html#pessimistic-disconnection-detection-added-to-the-connection-pool
>>
>> then in the main docs, the new flag replaces the previous "pessimistic
>> disconnect" recipe:
>>
>>
>> http://docs.sqlalchemy.org/en/latest/core/pooling.html#pool-disconnects-pessimistic
>>
>> in terms of a Session, the Session in non-autocommit mode, bound to an
>> Engine and not a specific Connection, does a connection pool checkout
>> per transaction, or in autocommit mode does checkout-per-statement, or
>> in autocommit mode when you use begin()/commit() again checkout per
>> transaction.
>
>
> Sorry, my question isn't coming across right... in non-autocommit mode,
> assuming the following example...
>
>     # start the session
>     s = Session()
>
>     # waste some time...
>     time.sleep(10)
>
>     # get Foo.1
>     s.query(Foo).get(1)
>
>     # done
>     s.rollback()
>
> does the pool checkout logic happen on `s = Session()` or `s.query(...` ?
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalch...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy-alembic+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to