On Mar 1, 2006, at 9:57 AM, Alan Franzoni wrote:

Hello! I'd like to attach a sort of 'event' to an object mapped using
sqlalchemy; this way I could create a sort of db-independent trigger that would be activated whenever the object is changed (and thus an UPDATE or DELETE is performed). A big candidate for this would be a 'last_modified'
column where I'd like to store a timestamp. I'm currently employing a
'workaround' solution, consisting of a write() metod in the mapped object,
which roughly does:

def write(self):
        self.last_modified = mx.DateTime.now()
        objectstore.commit(self)

But I don't like it, because I'd like to commit many objects at once.

1. do you want the object to be committed to the DB every time an attribute changes ? what if you change three attributes on the object, then three commits ? i.e., what is the actual "event"

2. if I have three objects, x, y and z, and this "event" occurs on all three, if youd like to commit many objects at once, at what point do those "events" trigger the actual "save" event ?



-------------------------------------------------------
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

Reply via email to