On Apr 13, 2007, at 2:37 PM, Ants Aasma wrote:
> > 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". OK, first thing i wasnt sure about, is CASE supported on every DB that we support. I took a look at our CASE unit test and it appears it applies to all DBs...(although i cant verify it passes on firebird). while it goes slightly against my desire for SA to remain primarily an extremely thin layer over SQL for something as small as foo.in_() to explode into a CASE like that, i think your support for the feature is much stronger than my antsiness about it so i will support it, considering the alternate behavior is just to throw an error. really, the work to do here is 5% the patch to the in_() method, and 95% making me a really nice unit test suite that will generatively test IN for every contingency....including the bind param stuff in #476 (but simpler code than whats patched there). otherwise its giong to sit in the queue for awhile since i still have a lot of other more pressing patches i havent yet had the time to test/apply. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---