Hi,

I need to implement the storage of the neighborood of a place. I try to 
use Declarative and relation to get this done but it sounds like I 
missed something important I can not understand.

Here are my models:

neighbors_table = Table('neighbors', Base.metadata,
     Column('shop_id', Integer, ForeignKey('places.id'), primary_key=True),
     Column('neighbor_id', Integer, ForeignKey('places.id')),
     )


class Place(Base):
     __tablename__ = 'places'
     name = Column(Unicode(255), nullable=True)

     neighbors = relation('Place', secondary=neighbors_table)

But as soon as I try to use a Place object, I get this error:

sqlalchemy.exc.ArgumentError: Could not determine join condition between 
parent/child tables on relation Shop.neighbours.  Specify a 
'primaryjoin' expression.  If this is a many-to-many relation, 
'secondaryjoin' is needed as well.

I tried to add a primaryjoin and a secondaryjoin but with no success. 
Sounds like I don't understand what are primaryjoin and a secondaryjoin 
expressions.

Any idea ?

Regards,

Laurent

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to