[sqlalchemy] Re: proposed extension to SessionExtension: after_bulk_operation

2008-11-05 Thread Martijn Faassen
Hi there, Michael Bayer wrote: I would say it should be called in any case, rows or not, and the result object provided. Just provide a patch and we're GTG. Done. The patch is attached. I can commit it myself if it looks all right. I wonder if a before_ hook should be provided as

[sqlalchemy] Re: proposed extension to SessionExtension: after_bulk_operation

2008-11-05 Thread Laurence Rowe
On Nov 5, 9:14 am, Martijn Faassen [EMAIL PROTECTED] wrote: Michael Bayer wrote:   I wonder if a before_ hook should be provided as well. I don't know myself; Laurence, if you're listening in perhaps you'd care to comment? While there is aesthetic value to having symmetrical before and

[sqlalchemy] Re: Using MapperExtension for timestamp - how to avoid related instances from being pulled in

2008-11-05 Thread Sok Ann Yap
On Wed, Nov 5, 2008 at 5:47 PM, Yap Sok Ann [EMAIL PROTECTED] wrote: I use a MapperExtension to automatically put the current timestamp into a updated_at column for all entities. This works fine except when related entities get involved. Let's say I have a Many-To-One relation between

[sqlalchemy] Using MapperExtension for timestamp - how to avoid related instances from being pulled in

2008-11-05 Thread Yap Sok Ann
I use a MapperExtension to automatically put the current timestamp into a updated_at column for all entities. This works fine except when related entities get involved. Let's say I have a Many-To-One relation between employees and departments. If I switch the department for an employee, even

[sqlalchemy] Re: Using MapperExtension for timestamp - how to avoid related instances from being pulled in

2008-11-05 Thread Sok Ann Yap
On Wed, Nov 5, 2008 at 6:10 PM, Sok Ann Yap [EMAIL PROTECTED] wrote: On Wed, Nov 5, 2008 at 5:47 PM, Yap Sok Ann [EMAIL PROTECTED] wrote: I use a MapperExtension to automatically put the current timestamp into a updated_at column for all entities. This works fine except when related entities

[sqlalchemy] Re: proposed extension to SessionExtension: after_bulk_operation

2008-11-05 Thread Michael Bayer
OK now that I see it, here's some things I think would make it more generally useful: 1. lets split it into after_bulk_update() and after_bulk_delete(), so that we can identify what operation just occured 2. lets pass the Query object and the QueryContext in so that more elaborate