diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-12-08 01:53:21 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-12-08 01:53:21 +0000 |
| commit | 71c0be09214564f0c766f77444a68348ba770508 (patch) | |
| tree | 4d63c4b3e8d57063feb12277ec1f5074b4728bce /lib/sqlalchemy/sql | |
| parent | 048f70ce85d254eff0b5ccf16fd4e15274b0bc6a (diff) | |
| download | sqlalchemy-71c0be09214564f0c766f77444a68348ba770508.tar.gz | |
- 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].
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/expression.py | 11 |
1 files changed, 3 insertions, 8 deletions
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): |
