On Feb 7, 2014, at 11:01 AM, Claudio Freire <klaussfre...@gmail.com> wrote:

> 
> I've had similar issues with 0.7.10. SA opens an implicit transaction,

incorrect, DBAPI does this, please see: 
http://www.python.org/dev/peps/pep-0249/#commit

there is no “explicit transaction” in DBAPI.   The docs have tried very hard to 
emphasize this as it is misleading to new users, but its outside of SQLAlchemy.

> and neither Session.remove nor Session.close really roll back the transaction

session.rollback() rolls back the transaction.   if you don’t call that, 
session.close() is as though you just closed the connection and did nothing, 
IMHO as it should be.  The connection pool, if in use, will then not actually 
“close” the connection if it is to remained pooled, it calls rollback() as part 
of the pool release mechanism.  Recent versions of SQLAlchemy allow this to 
show up in the engine logs like any other rollback, so you probably wouldn’t 
have noticed.

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

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to