theres a few things going on.

one is ticket #151.  so to work around that do:

assign_mapper(Person, people,
    properties={
        'accounts' : relation(Account.mapper,
primaryjoin=(accounts.c.xxperson_id==people.c.person_id),
foreignkey=accounts.c.xxperson_id, private=True) }
    )

the next is that your Manager and Engineer classes dont extend from
Person.  So I just committed an assertion for that into the Mapper to
insure that they are.

then, I also checked in one tweak to the relation() that gets attached to
Manager and Engineer so that it retains the initialization it gets from
the Person version instead of re-init'ing, which was also causing it to
initialize improperly.

so try rev 1285.

Vasily Sulatskov wrote:
> Hello sqlalchemy-users,
>
> I  have  some  problems  when  I  try  to use polymorphic objects with
> relation one to many (attached file will show problem).
>
> In short words problem is following:
> I create a mapper that is inherited from another mapper and I create a
> table with "one to many" relation with "base" mapper.
>
> And  when  I  select related objects using relation property I get all
> objects  from  "related"  table,  not just those with matching foreign
> key. (In case if I expalined poorly, I attached example script to show
> this problem).
>
> Am I doing something wrong? Or is that a problem with sqlaclhemy?
>
>
> --
> Best regards,
>  Vasily                          mailto:[EMAIL PROTECTED]



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to