Hey Michael, thanks for your fast response and especially the recipe. I completely forgot the FAQ. Most of my questions are usually covered by the documentation, and search engines seem to prefer StackOverflow et al.
On Mi, 2013-06-12 at 16:15 -0400, Michael Bayer wrote: > This is the FAQ entry we've had in place for many years: > > http://www.sqlalchemy.org/trac/wiki/FAQ#Isetthefoo_idattributeonmyinstanceto7butthefooattributeisstillNone-shouldntithaveloadedFoowithid7 > > But also, I've added a new recipe which shows how to get this behavior, and > also makes apparent some of the difficulties in establishing it completely > (requires a many-to-one be in place, accessing collections on the "reverse" > side can be tricky): > > http://www.sqlalchemy.org/trac/wiki/UsageRecipes/ExpireRelationshipOnFKChange > The FAQ and recipe state that recommended use is to set the relationship property instead of settings its underlying column -- and this what I usually do. When I ran into this, I used the 'onupdate' column parameter with a python function to set a 'last modified by' attribute. Doing an 'onupdate' on the relation does not seem to be easily accessible through a parameter, although I'm certain it's possible hooking into the right event. For now, I'll go with a scoped version of your recipe. Thanks a lot! Robert -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.