On Apr 6, 2006, at 3:01 AM, Qvx wrote:
I can work around all those issues (allready have) by explicitely
managing my transactions, but it would be nice if we could make it
work. Something like this:
# called from decorator
def run_with_transaction(func, *arg, **kw):
try:
# "begin" but don't necessary touch the database yet
sqlalchemy.something.implicitly_begin_all()
sqlalchemy.objectstore.clear()
retval = func(*args, **kw)
# now commit everything that was used in this thread
sqlalchemy.something.commit_all_used_dbs()
return retval
except:
sqlalchemy.something.rollback_all_used_dbs()
In this case I'm not sure haw would SA respond to begin/commit/
rollback inside decorated function. Ignore commits because there
was implicitly_begin_all() or allow me to explicitly manage my
affairs if i want.
I had in mind something like ,
# start new transaction
x = TransactionManager.Transaction()
then inside of engine.py, right at the point it uses the underlying
connection (this is very simplified):
def _execute(self, c, statement, parameters):
# join into the transaction already in progress
x = TransactionManager.current_transaction()
if x is not None and self not in x:
self.join_transaction(x)
c.execute(statement, parameters)
so that way, you wouldnt have to know what connections would be used,
each engine (or ConnecitonProxy, or something) would join in as they
were used.
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users