Ok .. I found it ! I works with :

'scientific_name' : relation(InvasiveName, 
primaryjoin=and_(invasives.c.id==invasive_names.c.invasive_id, 
invasive_names.c.language_id==languages.c.id, 
languages.c.iso_code=='la'), uselist=False),


Julien Cigar wrote:
> Hello !
>
> I have three tables (not everything is shown, for legibility):
>
> invasives (pk: id)
> languages (pk: id)
> invasive_names (pk: (fk: invasive_id, fk: language_id), invasive_name)
>
> invasives contains specimens and invasives_names are the names for 
> that specimen (in french, dutch, german, latin, ...)
>
> The scientific name for the specimen is in 'latin', and I'd like to 
> have a property 'scientific_name' in the invasive mapper whit the 
> latin name.
> I tried :
>
> mapper(Invasive, invasives, properties = {
>    (...)
>    'scientific_name' : relation(InvasiveName, secondary=invasive_names,
>        primaryjoin=invasives.c.id==invasive_names.c.invasive_id,
>        
> secondaryjoin=and_(invasive_names.c.language_id==languages.c.id, 
> languages.c.iso_code=='la')),
>    (...)
>    }
> )
>
> ... but I got an error :
>
> ArgumentError: No syncrules generated for join criterion 
> invasive_names.language_id = languages.id AND languages.iso_code = 
> %(languages_iso_code)s
>
> Any idea what I did wrong ?
>
> Thanks !
>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to