Does anyone know where I could find a working example of multiple levels of inheritance using joined table inheritance?
Right now I have the following class hierarchy - an AspectDetection and an RFDetection are subclasses of Detection, which in turn is a subclass of Event. Each of the classes has its own DB table, and an object can be simply an Event or a Detection. I've tried mapping these classes together using the following code: detection_join = detection.outerjoin(aspect_detection).outerjoin(rf_detection) event_join = detection_join.outerjoin(event) event_mapper = mapper(Event, event, select_table=event_join, polymorphic_on=event.c.discriminator, polymorphic_identity='event') detection_mapper = mapper(Detection, detection, select_table=detection_join, polymorphic_on=detection.c.discriminator, inherits=event_mapper, polymorphic_identity='detection') mapper(AspectDetection, aspect_detection, inherits=detection_mapper, polymorphic_identity='aspect_detection') mapper(RFDetection, rf_detection, inherits=detection_mapper, polymorphic_identity='rf_detection') However, I get some bizarre behavior - the discriminator field of the Event class is NULL in every line in the database, and whenever I run the following query - detections = session.query(Detection).all() - I get a list of objects that all have whose ID and Event-related field values are identical to the first Detection entered. However, the field values for the Detection object appear to be retrieved correctly. Any idea what I'm doing wrong, or does anyone have an example of working multi-level inheritance using joined tables? Thanks! Chris Guin --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---