On Fri, Feb 7, 2014 at 11:51 AM, Simon King <si...@simonking.org.uk> wrote:

> On Fri, Feb 7, 2014 at 9:28 AM, Christian Démolis <
> christiandemo...@gmail.com> wrote:
>
>> Hi all,
>>
>> Actually, i have some problem closing my session...
>> I tried using scopedsession with session.remove
>> I tried using normal session with session.close
>>
>> But in both cases, the Mysql session stay open.
>>
>>
>> Why closing session has no effet on current Mysql connections ?
>>
>>
> SQLAlchemy maintains a pool of connections to the database. When you start
> a session, it checks a connection out from the pool, and when you close the
> session, it returns it to the pool. There are various configuration
> parameters you can use to control how the pool works. See the docs at
> http://docs.sqlalchemy.org/en/rel_0_9/core/pooling.html
>


I've had similar issues with 0.7.10. SA opens an implicit transaction, and
neither Session.remove nor Session.close really roll back the transaction
(even though they should, I've had lots of experimental evidence that it
does not always do it).

So, what I suggest, is issuing a session.commit() or session.rollback()
(according to your transactional needs) before the session.close/remove

-- 
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 sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to