> >> - Using polymorphic, joined-table inheritance ? Forget > >> about polymorphic_union(), just join all the tables together > >> using outerjoin(). In 0.4, even the select_table argument > >> becomes optional. > > > > i am not sure if i got this right (a month already). A-B-C works, > > yes. But just explain to stupid me how would to do it for this > > simple tree: A, B(A), C(B), D(A). (or anything else having at > > least 2 siblings subclasses). All nodes have instances. > > a.outerjoin(b).outerjoin(c).outerjoin(d, a.c.id==d.c.id) ? and that would be which one, select_table for D? nooo.. but how would A look like? a.outerjoin(b).outerjoin(c).outerjoin(d) ? That is, outerjoin everything? order of outerjoining does not matter? hmm (testing testing) IMO this is the general rule: * any class X that has subclasses, should have in mapper() select_table = root.join(base1).join(base2)... .join(X) .outerjoin(subclass1).outerjoin(subclass2).... where base* are the levels between X and the root, and subclass* are all subclasses under X. * any class X that is leaf (has no subclasses), needs no select_table.
see the variant of examples/polymorph.py attached. ok, then i'll take polymorpic_union() off joined-table duty... > > Also, in the docs, u still talk about polymorphical concrete > > inheritance, while it does not really work. i mean, haveing some > > engineer.id=2 and some other manager.id=2 would break it... there > > would be 2 rows of id=2. Unless u know how to fix it. > > well technically i think thered be a "type" column on each table > too which you might make as part of a composite primary key. that > way PKs are unique within the union of all three tables. we should > make that work and fix the doc for it, but also i think youre the > only person to ever even attempt concrete inheritance too :) aha, good ole polymunion() will have a new job ;-) can this composite primary key be made just for the union? and the mapper should somehow know about it... ========== see, i dont really know what i (or some user) will need. so far i have an assert to save users from concrete polymorphism ;-). although some tests do work... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
polymorph.py
Description: application/python