[sqlalchemy] relationship trouble

2011-10-26 Thread Jakob L.
Hi! I added a new self-referential relationship to one of my tables but since I couldn't find how to create the new column through SA I added it to the db manually after checking how it's been done before. The code looks like this (using elixir): class User(Entity): username =

[sqlalchemy] relationship trouble when using UsageRecipes/Views

2011-09-07 Thread werner
I am working on my localization stuff and run into a problem when I want to add an relationship to a class. I based my code on http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Views , but maybe I messed something up. The following works: r1 = session.query(db.Region_LV).get(175) print

Re: [sqlalchemy] relationship trouble when using UsageRecipes/Views

2011-09-07 Thread Michael Bayer
On Sep 7, 2011, at 4:40 AM, werner wrote: or: Region_LV.language = sao.relationship('Language', primaryjoin=Country_LV.fk_language_id==Language.id, foreign_keys=[Country_LV.__table__.c.fk_language_id]) I get: sqlalchemy.exc.ArgumentError: Column-based

Re: [sqlalchemy] relationship trouble when using UsageRecipes/Views

2011-09-07 Thread werner
Michael, On 09/07/2011 05:10 PM, Michael Bayer wrote: On Sep 7, 2011, at 4:40 AM, werner wrote: or: Region_LV.language = sao.relationship('Language', primaryjoin=Country_LV.fk_language_id==Language.id, foreign_keys=[Country_LV.__table__.c.fk_language_id])

Re: [sqlalchemy] relationship trouble when using UsageRecipes/Views

2011-09-07 Thread Michael Bayer
On Sep 7, 2011, at 11:53 AM, werner wrote: Michael, On 09/07/2011 05:10 PM, Michael Bayer wrote: On Sep 7, 2011, at 4:40 AM, werner wrote: or: Region_LV.language = sao.relationship('Language', primaryjoin=Country_LV.fk_language_id==Language.id,

Re: [sqlalchemy] relationship trouble when using UsageRecipes/Views

2011-09-07 Thread werner
On 09/07/2011 05:58 PM, Michael Bayer wrote: On Sep 7, 2011, at 11:53 AM, werner wrote: Michael, On 09/07/2011 05:10 PM, Michael Bayer wrote: On Sep 7, 2011, at 4:40 AM, werner wrote: or: Region_LV.language = sao.relationship('Language',