values of ``None`` to :func:`.null`.
[ticket:2496]
.. changelog::
:version: 0.8.0
+ .. change::
+ :tags: bug, sql
+ :tickets: 2496
+
+ The :meth:`.ColumnOperators.in_` operator will now coerce
+ values of ``None`` to :func:`.null`.
+
.. change::
:tags: feature, sql
:tickets: 2657
raise exc.InvalidRequestError('in() function accept'
's either a list of non-selectable values, '
'or a selectable: %r' % o)
+ elif o is None:
+ o = null()
else:
o = expr._bind_param(op, o)
args.append(o)
select([t]).where(t.c.foo.in_(['x', 'y', 'z'])),
"SELECT sometable.foo FROM sometable WHERE sometable.foo "
"IN ('x', 'y', 'z')",
+ ),
+ (
+ t.c.foo.in_([None]),
+ "sometable.foo IN (NULL)"
)
]:
self.assert_compile(expr, compile, dialect=mxodbc_dialect)
{'param_1': 10}
)
+ def test_in_28(self):
+ self.assert_compile(
+ self.table1.c.myid.in_([None]),
+ "mytable.myid IN (NULL)"
+ )
+
class MathOperatorTest(fixtures.TestBase, testing.AssertsCompiledSQL):
__dialect__ = 'default'