.. changelog::
:version: 0.8.0
+ .. change::
+ :tags: bug, sql
+ :tickets: 2660, 1768
+
+ Fixed a bug regarding column annotations which in particular
+ could impact some usages of the new :func:`.orm.remote` and
+ :func:`.orm.local` annotation functions, where annotations
+ could be lost when the column were used in a subsequent
+ expression.
+
.. change::
:tags: bug, mysql, gae
:tickets: 2649
def _with_annotations(self, values):
clone = self.__class__.__new__(self.__class__)
clone.__dict__ = self.__dict__.copy()
- expression.ColumnElement.comparator._reset(self)
+ expression.ColumnElement.comparator._reset(clone)
clone._annotations = values
return clone
# also pass, [ticket:2425]
eq_(str(or_(b, b._annotate({"foo": "bar"}))),
":bind_1 OR :bind_1")
+
+ def test_comparators_cleaned_out_construction(self):
+ c = column('a')
+
+ comp1 = c.comparator
+
+ c1 = c._annotate({"foo": "bar"})
+ comp2 = c1.comparator
+ assert comp1 is not comp2
+
+ def test_comparators_cleaned_out_reannotate(self):
+ c = column('a')
+
+ c1 = c._annotate({"foo": "bar"})
+ comp1 = c1.comparator
+
+ c2 = c1._annotate({"bat": "hoho"})
+ comp2 = c2.comparator
+
+ assert comp1 is not comp2
+
+ def test_comparator_cleanout_integration(self):
+ c = column('a')
+
+ c1 = c._annotate({"foo": "bar"})
+ comp1 = c1.comparator
+
+ c2 = c1._annotate({"bat": "hoho"})
+ comp2 = c2.comparator
+
+ assert (c2 == 5).left._annotations == {"foo": "bar", "bat": "hoho"}