On Mon, Jun 22, 2009 at 06:30:24PM +0400, Oleg Broytmann wrote: > On Thu, Jun 11, 2009 at 07:26:59PM +0000, Matthew Wilson wrote: > > >>> sr = MyTable.select(false) # obviously empty > > >>> sr.filter(False).count() > > TypeError: 'bool' object is unsubscriptable > > Select clause is expected to be either SQLExpression or a string, not > bool.
Well, I have to explain this a bit better. If SQLObject got an SQLExpression or a string like 'test=1' it construct a query string like this: SELECT * FROM table WHERE test=1. There are two special cases for the clause - it can be None or the string 'all'. In this case SQLObject doesn't add WHERE at all or adds a trivial clause like '1=1'. But what SQLObject should do in case of bool? What SQL query should be constructed from MyTable.select(False)? Currently SQLObject constructs WHERE 0, but it is only a happy accident. Boolean values as a clause are not currently supported. Oleg. -- Oleg Broytmann http://phd.pp.ru/ p...@phd.pp.ru Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------------ Are you an open source citizen? Join us for the Open Source Bridge conference! Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. Need another reason to go? 24-hour hacker lounge. Register today! http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss