I agree this could be better. Not sure how deep we'd have to go to get multiple inheritance in single inheritance form to work, mapping to inheritance hierarchies is probably what adds most complexity to the ORM as it is. It's a very rare use case though, and also gets way harder when we start talking about joined inheritance which is generally supported in the same hierarchy as single, so it's hard to prioritize this feature.
On Jan 14, 2013, at 1:37 PM, Ethan Fremen wrote: > I am all down with the power of mixins. The reason I mapped things this way > is because I do have concrete instances of string, amount, and quantity. > > (I'm capturing data from receipts: "string" can be e.g. a receipt number, > amount can be e.g. a total, and quantity can be something unaffiliated with a > line item, like "number of seats reserved". > > I finally got this to work by re-declaring all the properties I wanted using > declared_attr on the "final" class, like the below. Which is fine in this > case, but slightly more annoying in the other case I have, where there are > quite a few inherited properties. > > -ethan > > class EvidenceLineItem(EvidenceAmount, EvidenceQuantity, EvidenceString): > __mapper_args__ = { 'polymorphic_identity': ProofItemClassType.line_item } > @declared_attr > def string(cls): > return Evidence.__table__.c.get('string',Column(String(length=255), > index=True)) > @declared_attr > def quantity(cls): > return Evidence.__table__.c.get('quantity',Column(Integer)) > @declared_attr > def amount(cls): > return Evidence.__table__.c.get('amount',Column(Integer, index=True)) > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/sqlalchemy/-/VuHxC54meNsJ. > 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. -- 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.