Hi.
I'm trying to add support to SQLALchemy 0.4 in nadbapi:
http://hg.mperillo.ath.cx/nweb/nadbapi/
However there is (among other things) a problem I do not understand.
Here is the code:
def _sessionTransaction(self, callable_, *args, **kwargs):
from sqlalchemy import orm
conn = self.contextual_connect()
sess = orm.create_session(bind=conn) # This cannot fail
try:
trans = sess.create_transaction()
try:
ret = callable_(conn, sess, *args, **kwargs)
trans.commit()
return ret
except:
trans.rollback()
raise
finally:
sess.close() # This cannot fail
conn.close()
And here is the problem:
File "/home/manlio/projects/hg/nweb/nadbapi/nadbapi/engine.py", line
305, in _sessionTransaction
trans.commit()
File
"/home/manlio/projects/svn-external/sqlalchemy/trunk/lib/sqlalchemy/orm/session.py",
line 222, in commit
self.close()
File
"/home/manlio/projects/svn-external/sqlalchemy/trunk/lib/sqlalchemy/orm/session.py",
line 245, in close
t[1].close()
File
"/home/manlio/projects/svn-external/sqlalchemy/trunk/lib/sqlalchemy/engine/base.py",
line 944, in close
if not self._parent._is_active:
AttributeError: 'TLTransaction' object has no attribute '_parent'
I'm using SQLAlchemy from trunk.
I see from the sources that now the Session object has a transactional
argument.
How can I use it in my code?
Is it available in SQLAlchemy 0.3?
Thanks Manlio Perillo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---