Re: [SQLObject] a complex query question

2009-03-13 Thread Daniel Fetchinson
> Hi Daniel > Hi Oleg, > > I don´t know how to realize this with union but i think this should do it > > > # plain sql would be sth like this (untested) > select * from comment > where (object='zoo' and object_id=?) > or (object='cage' and object_id in (select id from cage where zoo=?)) > or (objec

Re: [SQLObject] a complex query question

2009-03-12 Thread Frank Wagner
Hi Daniel Hi Oleg, I don´t know how to realize this with union but i think this should do it # plain sql would be sth like this (untested) select * from comment where (object='zoo' and object_id=?) or (object='cage' and object_id in (select id from cage where zoo=?)) or (object='animal' and obje

Re: [SQLObject] a complex query question

2009-03-12 Thread Oleg Broytmann
On Wed, Mar 11, 2009 at 06:52:17PM -0700, Daniel Fetchinson wrote: > Unfortunately I haven't found > working examples of SQLBuilder + UNION constructions so far, if I > don't manage to get it right I'll probably come back :) If you manage to get it right please come back anyway and show us an e

Re: [SQLObject] a complex query question

2009-03-11 Thread Daniel Fetchinson
>> 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 t

Re: [SQLObject] a complex query question

2009-03-11 Thread Oleg Broytmann
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 = U