On Aug 2, 2011, at 3:33 AM, Torsten Landschoff wrote:

> 
> I looked at the is_active flag in SQLAlchemy 0.6.8 already and I think I
> can only use it with autocommit disabled. Unfortunately I use
> autocommit=True.

if you're in autocommit=True and you're calling session.flush() which fails, it 
rolls back just once, then the session is basically back to normal.  You 
shouldn't be getting that error you're getting (unless you're doing your own 
nesting with begin()/rollback(), in which case is_active counts).

Here's the full check for a Session that is usable:

session.transaction is None or session.is_active

with autocommit=True, session.transaction remains None when the Session is in 
between operations.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to