Thread: [SQLObject] MultipleJoin problem
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Jeremy C. <je...@co...> - 2005-01-12 16:22:58
|
I am converting an old web based system from TCL to Python and I am using SQLObject to help me out with the task. Here's my structure: CREATE TABLE users ( id int ....); CREATE TABLE roles ( name varchar(20), desc varchar(80)); CREATE TABLE user_roles ( user_id int, role varchar(20)); As you can see, this does *not* follow any type of standard. I wish that it did, but it would be big work to make a change to standardize it. I am trying to use RelatedJoin to map Users to Roles, and Roles to Users but am failing miserably. I have tried it what seems like 100 different ways, but a synario is (in Users class): roles = RelatedJoin('Roles', intermediateTable='user_roles') This obviously cannot work because of the goofy naming in user_roles, but how *can* I make it work? Thanks, Jeremy |
From: Oleg B. <ph...@ph...> - 2005-01-12 17:52:09
|
On Wed, Jan 12, 2005 at 11:22:55AM -0500, Jeremy Cowgar wrote: > roles = RelatedJoin('Roles', intermediateTable='user_roles') > > This obviously cannot work because of the goofy naming in user_roles, but how > *can* I make it work? By explicitly naming join_coumn. If that does not help - try to create your own column, descendant of RelatedJoin. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |