Re: [SQLObject] a complex query question
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2009-03-11 09:36:24
|
On Tue, Mar 10, 2009 at 11:59:33PM -0700, Daniel Fetchinson wrote: > class comment( SQLObject ): > object_id = Int( ) # this is the 'id' of the object this comment > is associated to > object_ = StringCol( validator=OneOf( [ 'animal', 'cage', 'zoo' ] > ) ) # type of object > content = UnicodeCol( ) # the actual comment > > select all comments that belong either to this zoo instance or to > any cage in this zoo or any animal that is in a cage in the zoo? With such a setup the only way I can see is to issue a complex UNION query that unions 3 different queries - SELECT comments for zoo, cages and animals. UNION queries are, of course, impossible with SQLObject tables but possible with SQLBuilder. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |