diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-09-22 16:14:58 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-09-22 16:14:58 -0400 |
commit | 1ceda8c23c277fd68bc159962f276d20cfa7bbf1 (patch) | |
tree | 438967fd83e543786556bc401f09b1c926cc89c2 /lib/sqlalchemy/sql/operators.py | |
parent | 03cb8ce548a99b97852c25f2fec26ed611afbb5c (diff) | |
download | sqlalchemy-1ceda8c23c277fd68bc159962f276d20cfa7bbf1.tar.gz |
- [bug] Added missing operators is_(), isnot()
to the ColumnOperators base, so that these long-available
operators are present as methods like all
the other operators. [ticket:2544]
Diffstat (limited to 'lib/sqlalchemy/sql/operators.py')
-rw-r--r-- | lib/sqlalchemy/sql/operators.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py index 38936231d..ad9fa4668 100644 --- a/lib/sqlalchemy/sql/operators.py +++ b/lib/sqlalchemy/sql/operators.py @@ -368,6 +368,36 @@ class ColumnOperators(Operators): """ return self.operate(in_op, other) + def is_(self, other): + """Implement the ``IS`` operator. + + Normally, ``IS`` is generated automatically when comparing to a + value of ``None``, which resolves to ``NULL``. However, explicit + usage of ``IS`` may be desirable if comparing to boolean values + on certain platforms. + + .. versionadded:: 0.7.9 + + .. seealso:: :meth:`.ColumnOperators.isnot` + + """ + return self.operate(is_, other) + + def isnot(self, other): + """Implement the ``IS NOT`` operator. + + Normally, ``IS NOT`` is generated automatically when comparing to a + value of ``None``, which resolves to ``NULL``. However, explicit + usage of ``IS NOT`` may be desirable if comparing to boolean values + on certain platforms. + + .. versionadded:: 0.7.9 + + .. seealso:: :meth:`.ColumnOperators.is_` + + """ + return self.operate(isnot, other) + def startswith(self, other, **kwargs): """Implement the ``startwith`` operator. |