Re: [sqlalchemy] Feature request - sqlalchemy.sql.operators.ColumnOperators.not_in_

52 views
Skip to first unread message

Michael Bayer

unread,
Sep 29, 2012, 12:11:14 AM9/29/12
to sqlal...@googlegroups.com

On Sep 28, 2012, at 1:54 PM, Jonathan Vanasco wrote:

> I would really like to make a feature request for a `not_in_` operator for sqlalchemy.sql.operators.ColumnOperators
>
> there are at least 2 ways to make a valid query right now :
>
> filter( ~ table.column.in_( (1,2,) ) )
> filter( sqlalchemy.not( table.column.in_( (1,2,) ) )
>
> so there isn't any problem in missing or broken functionality
>
> this is just a fairly common comparison (in my experience) , and when looking through code or trying to regex queries out of source code during debugging / testing sessions it becomes a bit of a pain to find these.
>
> it would just be a lot easier to maintain code if i could search for instances of column.not_in_ , than having to find the instances of column.in_ and then filtering down to one of 2(+?) options someone might have used. (or vice versa)
>
> this probably holds true for other comparisons too, this one was just really irritating me this week.

there are some "not" operators but currently they arent attached to ColumnOperators. You can get them from sqlalchemy.sql.operators and they are:

notin_op(), notlike_op(), notilike_op()

so like:

notin_op(left, right)


as far as sticking them on ColumnOperators I'm a little concerned about more than one way to do it, but I suppose the analogue is in python: "not x is y" vs. "x is not y". So sure. but id rather keep on 0.8 for this as a lot of other aspects of operators are changing.

Jonathan Vanasco

unread,
Sep 29, 2012, 11:30:37 AM9/29/12
to sqlal...@googlegroups.com
thanks for the reply.

if this ever happens, ., .8, .9, etc doesn't matter.  would just be so useful.
Reply all
Reply to author
Forward
0 new messages