multiple inheritance

Issue #2509 wontfix
Sassan Haradji created an issue

It'd be fantastic if sql-alchemy could support multiple inheritance: A B | / |/ C Sometimes C should be child of A and B, not just being a child of A and keeping a foreign key for B.

Comments (3)

  1. Mike Bayer repo owner
    • changed component to orm
    • marked as minor
    • changed milestone to blue sky
    • assigned issue to

    Unfortunately this is not something SQLAlhcemy is ever slated to support directly. It is theoretically possible which you can see discussed at http://www.agiledata.org/essays/mappingObjects.html#MappingMultipleInheritance.

    However, the logistics of SQLA's current single-hierarchy inheritance are incredibly complicated and have taken years to develop, with a large list of missing features and behavioral issues still in the process of being resolved.

    To support multiple directly, instead of just approximating it using relationship() which is doable right now, would incur a massive refactoring, while the prevalence of this use case in the real world is near zero. Given this huge ratio of difficulty to usefulness, it can't currently be justified as a development effort.

  2. Mike Bayer repo owner

    Also note that the complexity of multiple would make for more complex data structures within the ORM internals, which would be extremely likely to add considerable performance overhead to speed-critical operations such as loading objects and flushing.

  3. Log in to comment