On Apr 13, 6:40 pm, "Rick" <[EMAIL PROTECTED]> wrote:
> Sorry, it looks like is already being discussed.  (Serve me right for
> reading in threaded mode.)  From my SA-newbie POV, I'd love it if
> col.in_() compiled down to false or 0 (whatever works).

col.in_() is easy to get working correctly, the problem is
not_(col.in_()). In order to be consistent with regular IN behaviour
this should only return rows with non null values. By example of mysql
(because it has the nicest display, others work the same):
mysql> SELECT null IN (1,2,3), 0 IN (1,2,3), NOT null IN (1,2,3), NOT
0 IN (1,2,3)\G
*************************** 1. row ***************************
    null IN (1,2,3): NULL
       0 IN (1,2,3): 0
NOT null IN (1,2,3): NULL
   NOT 0 IN (1,2,3): 1

To be locally consistent with this behaviour the expression should
return null when col is null, else return false. The case statement
mentioned before is actually the most straightforward encoding of this
behaviour. It is big only due to verbosity of SQL syntax. In Python it
would be "None if col is None else False".


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to