From: Cedric B. <wo...@in...> - 2005-07-27 12:40:27
|
> > how do I do the following sql.request : > > SELECT person.id, person.name from person, person_role, role > > where > > person.id = person_role.person_id and > > role.id = person_role.role_id and > > role.name='editor'; > > > > with SQLObject ?? > > # something like this... > > query=Person.select(AND(Role.q.name=='editor', Role.q.personID == Person.q.roleID)) > > # Untested: > query=Person.select( > AND( > Person.q.id == PersonRole.q.personID, > Role.q.id == PersonRole.q.roleID, > Role.q.name=='editor', > ) > ) sounds good ! at one exception, is that I've never defined a PersonRole class in python. The table person_role has been automagically created ! Can be the class also beeing automagically created ? for memory, the classes's definition was as follow : class Person (SQLObject): name=StringCol() roles = RelatedJoin('Role') class Role (SQLObject): name = StringCol(alternateID=True,notNone=True,length=50) persons = RelatedJoin('Person') Ced. P.-S. Sorry Oleg to not have posted here a first. : ( -- Cedric BRINER Geneva - Switzerland |