I have a User model with an association proxy referencing the Email model, so I can access the user's email via user.email. Since I'm soft-deleting users and require emails for non-deleted users to be unique, I have a unique constraint on my email table with a `WHERE not is_user_deleted`. In the User model I have a property that automatically sets email.is_user_deleted when User.is_deleted is set.
However, when setting user.email = 'something' for an already deleted user, the association proxy only runs my creator callable UserEmail(email=v) and never sets is_user_deleted=True. Since the user instance if not available within the creator function of the association proxy I wonder if there's any way I can run code whenever something is added to the underlying relationship (User._email), i.e. something like this: @on_stuff_added(User, '_email') def do_stuff(user, email): email.is_user_deleted = user.is_deleted -- 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. For more options, visit https://groups.google.com/d/optout.