Hey Mike,

I was thinking more of this one:

class User(object):
    pass
class Keyword(object):
    pass
Keyword.mapper = mapper(Keyword, keywords)
User.mapper = mapper(User, users, properties={
    'keywords':relation(Keyword.mapper, 
        primaryjoin=users.c.user_id==userkeywords.c.user_id,
        secondaryjoin=userkeywords.c.keyword_id==keywords.c.keyword_id
        )
})

right before the Lazy/Eager Joins Multiple Times to One Table section.
-G

On Sunday, April 23, 2006, 9:30:25 PM, you wrote:
> gambit -

> this doc ?

> # define a mapper that does many-to-many on the 'itemkeywords'  
> association
> # table
> Article.mapper = mapper(Article, articles, properties = dict(
>          keywords = relation(mapper(Keyword, keywords), itemkeywords,  
> lazy=False)
>          )
>      )

> "itemkeywords" is the secondary table in that one.

> On Apr 23, 2006, at 1:25 PM, Gambit wrote:

>> Hey Michael,
>>
>> So the docs will be updated with this, then?
>> -G
>>
>> On Sunday, April 23, 2006, 5:54:33 PM, you wrote:
>>> you need the "secondary" table explicit in a many-to-many join:
>>
>>> Information.mapper.add_property('datas', relation(Data.mapper,
>>> rel_table,
>>>         primaryjoin=info_table.c.pk==rel_table.c.info_pk,
>>>         secondaryjoin=rel_table.c.data_pk==data_table.c.pk))
>>
>>
>>
>>> On Apr 23, 2006, at 8:39 AM, Gambit wrote:
>>
>>>> Hey All,
>>>>
>>>> I'm trying to reproduce, almost exactly, the many to many
>>>> relationship in the
>>>> docs (search for the 'secondaryjoin' keyword) and am encountering an
>>>> ArgumentError:
>>>>
>>>>    sqlalchemy.exceptions.ArgumentError: Property 'datas' specified
>>>> with secondary
>>>>    join condition but no secondary argument.
>>>>
>>>> I've attached a working test case to this email, and the debug
>>>> output.  As
>>>> you'll note, it's virtually identical to the example in the
>>>> documentation.
>>>>
>>>> Operating environment is:
>>>> Windows XP SP2
>>>> Cygwin
>>>> Python 2.4.3
>>>> SQLALchemy 0.1.6 rev 1320
>>>> SQLite
>>>>
>>>> Cheers,
>>>> -G
>>>> <many_to_many_test.log>
>>>> <many_to_many_test.py>
>>



> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to