summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-10-15 01:54:04 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-10-15 01:54:04 +0000
commitf64768658d59711c7b5035ea431faf5b4fa678df (patch)
treec802bf1b3ebb7353d911e8b91265a94c54a5329a /lib/sqlalchemy
parente57c94c64fdcf47da18fdade8af1dec8f6c45a72 (diff)
downloadsqlalchemy-f64768658d59711c7b5035ea431faf5b4fa678df.tar.gz
- much more query verbiage
- contains() operator doesn't need to generate negation criterion unless many-to-many
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/properties.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py
index 90a7ba3a4..bc4cfeca0 100644
--- a/lib/sqlalchemy/orm/properties.py
+++ b/lib/sqlalchemy/orm/properties.py
@@ -188,7 +188,7 @@ class PropertyLoader(StrategizedProperty):
return ~sql.exists([1], self.prop.primaryjoin)
elif self.prop.uselist:
if not hasattr(other, '__iter__'):
- raise exceptions.InvalidRequestError("Can only compare a collection to an iterable object.")
+ raise exceptions.InvalidRequestError("Can only compare a collection to an iterable object. Use contains().")
else:
j = self.prop.primaryjoin
if self.prop.secondaryjoin:
@@ -235,11 +235,11 @@ class PropertyLoader(StrategizedProperty):
raise exceptions.InvalidRequestError("'contains' not implemented for scalar attributes. Use ==")
clause = self.prop._optimized_compare(other)
- j = self.prop.primaryjoin
if self.prop.secondaryjoin:
+ j = self.prop.primaryjoin
j = j & self.prop.secondaryjoin
+ clause.negation_clause = ~sql.exists([1], j & sql.and_(*[x==y for (x, y) in zip(self.prop.mapper.primary_key, self.prop.mapper.primary_key_from_instance(other))]))
- clause.negation_clause = ~sql.exists([1], j & sql.and_(*[x==y for (x, y) in zip(self.prop.mapper.primary_key, self.prop.mapper.primary_key_from_instance(other))]))
return clause
def __ne__(self, other):