Martijn Faassen wrote:
> Hi there,
> 
> I've been using zope.sqlalchemy's integration with SQLALchemy and it's 
> been working pretty well so far.
> 
> Today however I ran into a snag when using session.query(..).delete(). 
> While a query immediately after the delete showed no more objects, in 
> the next transaction the objects would re-appear.
> 
> This turned out because zope.sqlalchemy tracks whether a session has 
> changed over time, and has no way of tracking the transaction has been 
> changed when this (and also session.query(..).update()) is in use, and 
> then rolls back the transaction.
> 
> zope.sqlalchemy offers a way to manually mark a transaction as changed:
> 
>    zope.sqlalchemy.mark_changed()
> 
> It's annoying however to have to remember to call this when using these 
> operations.
> 
> After discussion between myself and Laurence Rowe we came up with the 
> following proposal (mostly it's Laurence's :):
> 
>    session.query(...).delete() and session.query(...).update() call
>    a new method on SessionExtension, if at least result.rowcount != 0. We
>    propose the name after_bulk_operation() for this new method.
> 
>    We can then modify zope.sqlalchemy's SessionExtension to mark the
>    session as changed by hooking into this method.
> 
> What do people think?

+1

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to