]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Ensure we check that SQL expression has an .info attribute
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 4 Apr 2017 13:06:13 +0000 (09:06 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 4 Apr 2017 13:06:13 +0000 (09:06 -0400)
Fixed regression released in 1.1.8 due to :ticket:`3950` where the
deeper search for information about column types in the case of a
"schema type" or a :class:`.TypeDecorator` would produce an attribute
error if the mapping also contained a :obj:`.column_property`.

Change-Id: I38254834d3d79c9b339289a8163eb4789ec4c931
Fixes: #3956
doc/build/changelog/changelog_11.rst
lib/sqlalchemy/ext/mutable.py
test/ext/test_mutable.py

index 3a5b29decbc227f60f910b741aaa0063777201b5..f4b782093f610f706ac1d04f2483e83985f8c0e8 100644 (file)
 .. changelog::
     :version: 1.1.9
 
+    .. change:: 3956
+        :tags: bug, ext
+        :tickets: 3956
+
+        Fixed regression released in 1.1.8 due to :ticket:`3950` where the
+        deeper search for information about column types in the case of a
+        "schema type" or a :class:`.TypeDecorator` would produce an attribute
+        error if the mapping also contained a :obj:`.column_property`.
+
     .. change:: 3952
         :tags: bug, sql
         :versions: 1.2.0b1
index a133f950d5fa04d0f5b6e70ce97147bc20466a7a..e721397b3e67866919d5911e319c944d1269ead8 100644 (file)
@@ -600,7 +600,8 @@ class Mutable(MutableBase):
             for prop in mapper.column_attrs:
                 if (
                         schema_event_check and
-                        prop.columns[0].info.get('_ext_mutable_orig_type')
+                        hasattr(prop.expression, 'info') and
+                        prop.expression.info.get('_ext_mutable_orig_type')
                         is sqltype
                 ) or (
                     prop.columns[0].type is sqltype
index 5b6d3e7cf7a6c1e9e506866d9532d09dd89dc246..23bccafe9298fcf1602ab2cc8de5b8b1fdba0f7a 100644 (file)
@@ -1,6 +1,6 @@
-from sqlalchemy import Integer, ForeignKey, String
+from sqlalchemy import Integer, ForeignKey, String, func
 from sqlalchemy.types import PickleType, TypeDecorator, VARCHAR
-from sqlalchemy.orm import mapper, Session, composite
+from sqlalchemy.orm import mapper, Session, composite, column_property
 from sqlalchemy.orm.mapper import Mapper
 from sqlalchemy.orm.instrumentation import ClassManager
 from sqlalchemy.testing.schema import Table, Column
@@ -761,6 +761,8 @@ class MutableColumnCopyJSONTest(_MutableDictTestBase, fixtures.MappedTest):
 
         class Foo(AbstractFoo):
             __tablename__ = "foo"
+            column_prop = column_property(
+                func.lower(AbstractFoo.unrelated_data))
 
         assert Foo.data.property.columns[0].type is not AbstractFoo.data.type