how to "rename" a column name with sqlobject?

12 views
Skip to first unread message

Julio Jimenez

unread,
Oct 17, 2008, 12:17:14 PM10/17/08
to TurboGears
I'm trying to work with a legacy mysql database and in one table there
is a column named "pass" which is a reserved word on python, I've
searched a lot on google and the sqlobject docs but all I can find is
how to get around table naming issues, not single columns. The model
is just configured to be grabbed from the db son there's nothing I can
post here.

Thanks,

Julio J.

Kane

unread,
Oct 18, 2008, 1:46:02 PM10/18/08
to TurboGears
I believe you will have to define this table rather than pulling it
automatically from the db, that will allow you to override the
autogenerated python name for the column using dbName. Something like
this:

Does not work:
class User(SQLObject):
pass = StringCol(alternateID=True)
lists = MultipleJoin('List')


Should work:
class User(SQLObject):
userpass = StringCol(alternateID=True, dbName="pass")
lists = MultipleJoin('List')
Reply all
Reply to author
Forward
0 new messages