On Thursday November 20, 2008 14:45:54 guistebal wrote:
> Yes, but when you want to adapt an already existing table with
> different column names and you wan't to do minimal changes, the easier
> way I found, which does not break anything anywhere, was to rename
> columns like :
>
> user_name = Column('MyUserName',Unicode, unique=True)
>
> For a reason that I don't really understand, SQLAlchemy cannot
> determine joins automatically in relations in this case and joins must
> be defined manually. Hence, the relation in Group becomes :
>
> users = relation('User',
> primaryjoin=group_id==user_group_table.c.MyGroupID,
> secondaryjoin=user_group_table.c.MyUserID==User.user_id,
>                  secondary=user_group_table, backref='groups')
>
> ...but you need User to be already defined.

I think I'm even more confused now ;-)

In your first email you talk about a proposal. What's exactly the proposal? I 
see you only talk about SQLAlchemy.

Anyway, the code above is too complex. What don't you just use the line below?
    users = relation('User', backref='groups')

It should work. You may take a look into a TG2 quickstarted project for a 
complete example.

Cheers.
-- 
Gustavo Narea.
General Secretary.
GNU/Linux Matters <http://gnulinuxmatters.org/>.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to