summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/expression.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-09-22 16:45:02 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-09-22 16:45:02 -0400
commit6c50ffcf44b8e363a5d3590955be1f62fd5e780d (patch)
tree46b3c82f39577dae3ff33ba8e415e0ae50b9da8e /lib/sqlalchemy/sql/expression.py
parent1ceda8c23c277fd68bc159962f276d20cfa7bbf1 (diff)
downloadsqlalchemy-6c50ffcf44b8e363a5d3590955be1f62fd5e780d.tar.gz
- aaand actually get is/isnot to be usable with None/NULL
Diffstat (limited to 'lib/sqlalchemy/sql/expression.py')
-rw-r--r--lib/sqlalchemy/sql/expression.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index 50f8061a6..f00926e4d 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -1952,10 +1952,10 @@ class _DefaultColumnComparator(operators.ColumnOperators):
**kwargs
):
if obj is None or isinstance(obj, Null):
- if op == operators.eq:
+ if op in (operators.eq, operators.is_):
return BinaryExpression(expr, null(), operators.is_,
negate=operators.isnot)
- elif op == operators.ne:
+ elif op in (operators.ne, operators.isnot):
return BinaryExpression(expr, null(), operators.isnot,
negate=operators.is_)
else:
@@ -3156,6 +3156,9 @@ class Null(ColumnElement):
def __init__(self):
self.type = sqltypes.NULLTYPE
+ def compare(self, other):
+ return isinstance(other, Null)
+
class False_(ColumnElement):
"""Represent the ``false`` keyword in a SQL statement.