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 It works just fine for your simple case here, we're just not in a position to support this kind of thing in 100% of cases. On Jun 12, 2013, at 2:12 PM, Robert Buchholz <robert.buchh...@goodpoint.de> wrote: > Hello, > > today I've been bit again by a one-to-many relation not updating when > its underlying foreign key changed. This feels inconsistent, especially > since its behavior depends on whether the relationship was referenced > before the change or not. > > A reduced example is attached, with comments / expectations inline. > > I was not able to find documentation, a bug or mailing list thread. > Maybe I missed something obvious? > > > Cheers > > 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. > > > <relationship_update.py> -- 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.