Re: [sqlalchemy] Multiple many to one relationships to same table

2016-03-19 Thread 'Chris Norman' via sqlalchemy
Hi, You're completely correct - it's a bit stupid if all I'm using is SQL. Actually the rows in the table are just for storing things reliably, and all the magic happens with python classes which are as you describe. Thank you for the help, I'll give it a go. On 15/03/2016 20:40, Christopher

Re: [sqlalchemy] Multiple many to one relationships to same table

2016-03-15 Thread Christopher Lee
A relationship usually looks at the foreign keys on the tables you specify and constructs the queries appropriately. The error you are getting happens because there are multiple foreign keys between the tables (in this case, the same table referencing itself... shudder...). You need to tell each

Re: [sqlalchemy] Multiple many to one relationships to same table

2016-03-15 Thread 'Chris Norman' via sqlalchemy
Hi, On 14/03/2016 15:19, Mike Bayer wrote: On 03/14/2016 11:15 AM, 'Chris Norman' via sqlalchemy wrote: Hi all, I've tried googling for this, and I get nothing. I have a table to store data about objects. Each object should have a location property which links back to the same table.

Re: [sqlalchemy] Multiple many to one relationships to same table

2016-03-14 Thread Mike Bayer
On 03/14/2016 11:15 AM, 'Chris Norman' via sqlalchemy wrote: Hi all, I've tried googling for this, and I get nothing. I have a table to store data about objects. Each object should have a location property which links back to the same table. Conversely, each object should have a contents

[sqlalchemy] Multiple many to one relationships to same table

2016-03-14 Thread 'Chris Norman' via sqlalchemy
Hi all, I've tried googling for this, and I get nothing. I have a table to store data about objects. Each object should have a location property which links back to the same table. Conversely, each object should have a contents property which shows all objects which have their location set to