im not a huge fan of cascade_mapper for reasons like this.

since you have an ambiguous join, perhaps youre looking for explicit join conditions ?

http://www.sqlalchemy.org/docs/ adv_datamapping.myt#adv_datamapping_relations_customjoin


On Mar 26, 2006, at 1:05 PM, Gambit wrote:

Hi guys -

I'm not sure this is a bug or not, but if not it might be worth adding a comment to the documentation.

Using the following schema:
table A:
        pk
        B_fk_1
        B_fk_2
        ...

table B:
        pk
        info

After setting up A and B correctly (see attachment), and performing cascade_mapper(A, B), looking at an instance of class A does not show any B instances (nor is it unambiguous what they should be called). There is, I note, a A.B entry, but with the value of None. Looking at the engine log, it is obvious what is happening - it is trying to find the B object which has a pk matching both B_fk_1 AND B_fk_2.

The documentation for cascade_mapper should be updated to either state that it's not the right tool for this situation, or perhaps a bug/feature request filed against cascade_mapper.

Incidentally, I am trying, as you can see from the attached larger sample, to build up to a correctly specified mapper for this testcase. This information may be in the docs already (if anyone wants to submit chapter and verse...?).

Cheers!
--G
<multiple_join_test.sql>



-------------------------------------------------------
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
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to