On Nov 19, 4:00 pm, Gustavo Narea <[EMAIL PROTECTED]> wrote:
> What version of TG2 did you have when you quickstarted the application? The
> declarative plugin is used as of TG2a4, so, as Jorge pointed out, it's easier
> with it.

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.
--~--~---------~--~----~------------~-------~--~----~
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