MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / not_in

Method not_in

lib/sqlalchemy/sql/operators.py:945–971  ·  view source on GitHub ↗

implement the ``NOT IN`` operator. This is equivalent to using negation with :meth:`.ColumnOperators.in_`, i.e. ``~x.in_(y)``. In the case that ``other`` is an empty sequence, the compiler produces an "empty not in" expression. This defaults to the express

(self, other: Any)

Source from the content-addressed store, hash-verified

943 return self.operate(in_op, other)
944
945 def not_in(self, other: Any) -> ColumnOperators:
946 """implement the ``NOT IN`` operator.
947
948 This is equivalent to using negation with
949 :meth:`.ColumnOperators.in_`, i.e. ``~x.in_(y)``.
950
951 In the case that ``other`` is an empty sequence, the compiler
952 produces an "empty not in" expression. This defaults to the
953 expression "1 = 1" to produce true in all cases. The
954 :paramref:`_sa.create_engine.empty_in_strategy` may be used to
955 alter this behavior.
956
957 .. versionchanged:: 1.4 The ``not_in()`` operator is renamed from
958 ``notin_()`` in previous releases. The previous name remains
959 available for backwards compatibility.
960
961 .. versionchanged:: 1.2 The :meth:`.ColumnOperators.in_` and
962 :meth:`.ColumnOperators.not_in` operators
963 now produce a "static" expression for an empty IN sequence
964 by default.
965
966 .. seealso::
967
968 :meth:`.ColumnOperators.in_`
969
970 """
971 return self.operate(not_in_op, other)
972
973 # deprecated 1.4; see #5429
974 if TYPE_CHECKING:

Calls 1

operateMethod · 0.95