On May 23, 2008, at 10:44 AM, Moshe Cohen wrote:
> Evidently, when the autoflush occurred within the commit(), the
> database transaction COMMIT itself happened before the call to
> after_update() .
thats not how it works. the steps are:
session.commit()
session.flush()
mapper._save_obj()
before_update/before_insert()
UPDATE/INSERT
after_update/after_insert()
engine.commit()
> The fact is that explicitly calling session.flush() immediately
> before calling session.commit(), changed the final state of the DB.
> This means the commit() with autoflush is not equivalent to flush
> and then commit.
it would be helpful if you could provide the evidence you're basing
this on. it sounds like your Session is not actually within a
transaction when you call flush(), so that the flush() begins and
commits its own transaction. If transactional=True, this would be a
bug. But then calling session.commit() should raise an error, so not
sure how you'd achieve that behavior, and I'm not seeing any codepath
that could produce that behavior - when transactional=True, a begin()
is issued in all cases before any flush call.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---