[sqlalchemy] Re: declarative and self-referential table

2008-11-11 Thread Michael Bayer
always use remote_side=table.c.id on the many to one side of a self referential relation, in the case of declarative it would look like remote_side=id. See http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_relation_selfreferential for information on this. On Nov 11, 2008,

[sqlalchemy] Re: declarative and self-referential table

2008-11-11 Thread MikeCo
Thanks for the pointer about remote_side. In my application, the table definitions are not visible at runtime, and the class definitions are autoloaded from the engine. So, I can't say remote_side=table.c.id because table is not available. I do have this solution that works well: class

[sqlalchemy] Re: declarative and self-referential table

2008-11-11 Thread Michael Bayer
On Nov 11, 2008, at 4:52 PM, MikeCo wrote: Thanks for the pointer about remote_side. In my application, the table definitions are not visible at runtime, and the class definitions are autoloaded from the engine. So, I can't say remote_side=table.c.id because table is not available. I do