Hi,

I am getting the following error when using sessions and session 
transactions.

sqlalchemy.exceptions.InvalidRequestError: This transaction is inactive

My code looks like the following:

session = create_session()

def other_method():
  global session
  b = OtherClass()
  session.save(b)
  session.flush()

trans = session.create_transaction()
try:
   o = TableClass()
   other_method()
   session.save(o)
   session.flush()
   trans.commit()
except:
    trans.rollback() # except thrown here


Sorry if this is a RTM question, but I'm getting a bit confused with all 
the different concepts of sessions, flushing, transactions, engines 
connections.

Can I find answers to the following questions in the manual ?
a. Does flush() affect nested transactions at all (assuming they are all 
on the same session) ?
b. Can different sessions participate in the same transaction ?

Many thanks,

Huy


_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to