rev 2233 changes some things.  you no longer can make your
"primaryjoin" conditions against the polymorphic selectable (i.e. the
pjoin)...in all cases now, make the join conditions against the base
tables (i.e. the way you originally had it):

        mapper_A.add_property( 'link1',
                relation( Alink == 'A' and A or B,
                    primaryjoin= table_A.c.link1_id==(Alink=='A' and
table_A or table_B).c.id,
                    foreignkey = (Alink=='A' and None or
table_A.c.link1_id),
                    remote_side=(Alink=='A' and table_A.c.id or None),
                    lazy=True, uselist=False, post_update=True
                )
        )

it also does a big explicit check/error message if you try to make the
joins against the select_table...since that was a pattern illustrated
in some examples and a few people may have things set up that way.

this approach is cleaner as now you never really deal with the
"polymorphic" selectable besides sending it off to your mapper, and an
entire class of errors these tests were getting go away since we arent
trying to find a foreignkey in a giant UNION anymore. the
LoaderStrategies of the relationships will "adapt" the more rudimentary
join conditions to the polymorphic selectable when they construct the
actual selection SQL.  (this is SA 0.3's greater separation of
relationship definition/loader strategy definition, while slightly more
latent in performance compared to 0.2, paying off).


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to