I'd like to represent a Correspondent object, which can refer to two separate objectsCorr_1- id- email_addressCorr_2- id- email_addressCorrespondent- idBut I have two problems:I'm using MySQL, so I can't use a check constraint to ensure that only one of the corr_*.id fields can be populated.
My second problem relates to then being able to retrieve the related .email_address attribute. My naïve relationship above obviously won't work for that. Any pointers would be greatly appreciated.
usually @property achieves this:class Correspondent(Base):@propertydef email_address(self):return self.corr_1.email_address if self.corr_1 else self.corr_2.email_address