Andreas Jung wrote: > On 27.12.2008 11:06 Uhr, Jim Jones wrote: > > Hi List, > > > > I have this simple model (in declarative style): > > > > class Item( Base ): > > __tablename__ = 'items' > > desc = Column( 'desc', UnicodeText(), nullable=False ) > > email = Column( 'email', UnicodeText(), nullable=False ) > > > > How can I trigger an event when the value of 'desc' has changed > > and the instance is persisted (e.g. via 'session.save(item)')? > > Please check the SA docs on using the decl. layer. It tells you how > to define your own get/set methods using the property mechanism.
Yes, I know about properties but as I understand it they fire when the value is set and not when the instance is persisted. I would like to make sure that my handler only fires when the change is actually written to the database - to avoid triggering it multiple times when the attribute is assigned to multiple times before save() for whatever reason. > If this is not good enough: check the MapperExtension mechanism, or > SessionExtensions or AttributeExtensions. AttributeExtension looks promising but I cannot find usage examples. How would I use these in my code? regards -jj --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---