Hi Michael,
On Mon, 2011-08-01 at 14:18 -0400, Michael Bayer wrote:
> The Session's default behavior is to expire fully the state present after a
> rollback occurs. The next access of any attribute will guaranteed pull
> fresh from the DB in a new transaction.
>
> I'm assuming you know this, and that there is something additional here
> you're looking for, like an event to the GUI to actually re-access the
> attributes, or something.
Exactly.
> A surprise for me. Yes the after_rollback() seems to only fire
> after an actual database rollback. This is a bug in that there is no
> way to catch soft rollbacks. I can't change the event, as it is
> integral in transactional extensions like that supplied for Zope; a
> new one will have to be added and the docs for after_rollback() will
> need to be updated.
Actually I expected after_rollback to fire only after an actual DB
rollback. Or did I misinterpret the errors in that the rollback came
before a flush to the database and therefore no actual reload from the
database would be needed?
> Ticket #2241 is added for this and is completed. You can now use the
> 0.7 tip and use the after_soft_rollback() event in conjunction with
> the is_active flag:
>
> @event.listens_for(Session, "after_soft_rollback")
> def do_something(session, previous_transaction):
> if session.is_active:
> session.execute("select * from some_table")
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.
I know that's a bad choice from the SQLAlchemy point of view. The reason
why I am using it is that I want to avoid to keep the database locked
over a long time, as this makes our background processes fail
(OperationalError: Database is locked). I am a victim of the limitations
of SQLite here :-(
Perhaps after the current stabilization phase, I will move to SA 0.7 and
autocommit=False. I am not sure about the latter though.
Thanks and Greetings, Torsten
--
DYNAmore Gesellschaft fuer Ingenieurdienstleistungen mbH
Torsten Landschoff
Office Dresden
Tel: +49-(0)351-4519587
Fax: +49-(0)351-4519561
mailto:[email protected]
http://www.dynamore.de
Registration court: Mannheim, HRB: 109659, based in Karlsruhe,
Managing director: Prof. Dr. K. Schweizerhof, Dipl.-Math. U. Franz
--
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.