robert -

thats not an incompatibility, thats just a bug.  or maybe the backref  
youre setting up needs to know the "primaryjoin" as well since it  
might not be as likely to make a "guess" in more recent versions:

Indice.mapper.add_property('leading_companies',
                            relation(Company.mapper,
                                     private=False, lazy=True,
                                     backref=backref 
('_leading_indice',primaryjoin=and_(<wahtever the backwards join  
is>), foreignkey=<whatever the backwards fkey is>),
                                      primaryjoin=and_(
                 indice_daily_table.c.code==Company.c.leadingIndex,
                 indice_daily_table.c.date==Company.c.date),
                                     foreignkey=Company.c.leadingIndex
                           ))

if its not the backref you need to submit a test program.

On Jun 11, 2006, at 7:03 PM, Robert Leftwich wrote:

> Michael Bayer wrote:
>> ... and everything will  still work.
>>
>
> Not quite :-(
>
> I have a many to many setup that was working in 0.1x that now fails  
> during
> mapping initialisation with the error "Cant find any foreign key  
> relationships
> between 'company_daily' and 'indice_daily'" from sql.py line 1050  
> (in the 0.2.2
> release).
>
> While it's true that the tables have no FK relationship defined  
> between them
> (they both have master tables which contain their respective fk's),  
> I'm
> specifying the primaryjoin (and I added foreignkey) when calling  
> add_property():
>
>    Indice.mapper.add_property('leading_companies',
>                               relation(Company.mapper,
>                                        private=False, lazy=True,
>                                        backref='_leading_indice',
>                                     primaryjoin=and_(
>                    indice_daily_table.c.code==Company.c.leadingIndex,
>                    indice_daily_table.c.date==Company.c.date),
>                                         
> foreignkey=Company.c.leadingIndex
>                              ))
>
> The basic relationship is that a company can be a member of many  
> indices (e.g.
> S&P500, S&P SmallCap600 for the U.S markets) and an Indice can have  
> many
> companies as a member. The best of these indices is termed the  
> leading index for
> the company. (Unfortunately) these relationships are volatile and  
> may change on
> a daily basis, hence the date and code join.
>
> What needs to change in my code for 0.2 to get this to work again?
>
> Robert
>
>
> _______________________________________________
> Sqlalchemy-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to