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

Reply via email to