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/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|