okay here anopther way to represent it. "this" side is the given prop/descriptor, and then the hops towards "other" end side:
MtoN: containerthis: getattr( prop.parent.class_, prop.key) midthis: getattr( prop.secondary, prop.remote_side[0]) -> this: getattr( prop.parent.class_, prop.local_side[0]) midother:getattr( prop.secondary, prop.remote_side[1]) -> other:getattr( prop.mapper.class_, prop.local_side[1]) containerother: getattr( prop.mapper.class_, ??????) 1toN: containerthis: getattr( prop.parent.class_, prop.key) other:getattr( prop.mapper.class_, prop.remote_side[0]) -> this:getattr( prop.parent.class_, prop.local_side[0]) other:getattr( prop.mapper.class_, ??????) *to1: this: getattr( prop.parent.class_, prop.key) -> this:getattr( prop.parent.class_, prop.local_side[0]) -> other:getattr( prop.mapper.class_, prop.remote_side[0]) other:getattr( prop.mapper.class_, ??????) did i get it right? how the backrefs would come above? is the assoc_proxy pattern looking similar as plain m2m or would be very different? On Monday 09 June 2008 03:56:20 Michael Bayer wrote: > On Jun 8, 2008, at 5:02 AM, [EMAIL PROTECTED] wrote: > > hi > > i'm trying to make a metainfo extractor off some relation > > attribute. by metainfo i mean the klas and attr-name of this and > > of the other side of the relation-attribute, or of the parent or > > child of the relation regardless the start point. > > > > e.g. possible usage and testing invariants is like: > > a = about_relation( someklas.someproperty) > > print a.name, a.klas, 'is_parent:', a.is_parent > > assert a.thisside == a > > b = a.otherside > > print b.name, b.klas, 'is_parent:', b.is_parent > > assert a.otherside.otherside == a > > if a.is_parent: > > assert a.child is a.otherside > > assert a.parent is a.thisside > > else: > > assert a.parent is a.otherside > > assert a.child is a.thisside > > e.g. if Parent.kids / Kid.parent are 1:many: > > print about_relation( Parent.kids).otherside.name -> 'mama' > > print about_relation( Parent.kids).otherside.klas -> 'Kid' > > print about_relation( Parent.kids).child.klas -> 'Kid' > > print about_relation( Kid.parent).child.klas -> 'Kid' > > print about_relation( Kid.parent).parent.klas -> 'Parent' > > print about_relation( Kid.parent).otherside.name -> 'kids' > > def about_relation(descriptor): > prop = descriptor.property > return { > 'child':{'name': prop.key, 'klas': prop.mapper.class_} > 'parent':{'klas':prop.parent.class_} > } > > I don't understand what "is_parent" means (nor 'thissside' and > 'otherside'). every relation has a "parent" and "child". > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---