Michael Bayer ha scritto:
> On Mar 19, 2009, at 12:34 PM, jo wrote:
>
>
>> Michael Bayer wrote:
>>
>>> why dont you just stick with None instead of "nn" ? then you just
>>> write:
>>>
>>> if v is None:
>>> clause.append(self.c.field != v)
>>> else:
>>> clause.append(self.c.field == v)
>>>
>> It could be an idea but not intuitive and unnatural
>>
>> because None = IS NOT NULL (very ugly) :-(
>> and null() = IS NULL
>>
>
> well the logic you're doing above seems unnatural all by itself, that
> if v is NULL you want a NOT NULL. that would seem just as
> "unnaturual" using "null()" as "None".
>
> just make yourself a notnull = not_(null()) and problem solved.
>
>
the hint you suggested me doesn't work because SQLAlchemy translate it
to " = (NOT NULL) " which is invalid sql...
print Tabella.search(tabella_id=not_(null())).compile()
SELECT tabella.id, ...
FROM tabella
WHERE tabella.id = (NOT NULL)
ERROR: operator does not exist: integer = boolean
LINE 3: WHERE tabella.id = (NOT NULL);
^
HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---