From 71c0be09214564f0c766f77444a68348ba770508 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 8 Dec 2009 01:53:21 +0000 Subject: - The "use get" behavior of many-to-one relations, i.e. that a lazy load will fallback to the possibly cached query.get() value, now works across join conditions where the two compared types are not exactly the same class, but share the same "affinity" - i.e. Integer and SmallInteger. Also allows combinations of reflected and non-reflected types to work with 0.5 style type reflection, such as PGText/Text (note 0.6 reflects types as their generic versions). [ticket:1556] - types now support an "affinity comparison" operation, i.e. that an Integer/SmallInteger are "compatible", or a Text/String, PickleType/Binary, etc. Part of [ticket:1556]. --- lib/sqlalchemy/sql/expression.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index a7cba8161..eb36558ce 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -2131,15 +2131,10 @@ class _BindParamClause(ColumnElement): return obj.type def compare(self, other, **kw): - """Compare this ``_BindParamClause`` to the given clause. - - Since ``compare()`` is meant to compare statement syntax, this - method returns True if the two ``_BindParamClauses`` have just - the same type. - - """ + """Compare this ``_BindParamClause`` to the given clause.""" + return isinstance(other, _BindParamClause) and \ - other.type.__class__ == self.type.__class__ and \ + self.type._compare_type_affinity(other.type) and \ self.value == other.value def __getstate__(self): -- cgit v1.2.1