--- /dev/null
+.. change::
+ :tags: bug, sql, ext
+ :tickets: 4141
+
+ Fixed issue in :class:`.ARRAY` datatype which is essentially the same
+ issue as that of :ticket:`3832`, except not a regression, where
+ column attachment events on top of :class:`.ARRAY` would not fire
+ correctly, thus interfering with systems which rely upon this. A key
+ use case that was broken by this is the use of mixins to declare
+ columns that make use of :meth:`.MutableList.as_mutable`.
def _set_parent_with_dispatch(self, parent):
"""Support SchemaEventTarget"""
+ super(ARRAY, self)._set_parent_with_dispatch(parent)
+
if isinstance(self.item_type, SchemaEventTarget):
self.item_type._set_parent_with_dispatch(parent)
self._test_non_mutable()
+class MutableColumnCopyArrayTest(_MutableListTestBase, fixtures.MappedTest):
+ __requires__ = 'array_type',
+
+ @classmethod
+ def define_tables(cls, metadata):
+ from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.sql.sqltypes import ARRAY
+
+ MutableList = cls._type_fixture()
+
+ Base = declarative_base(metadata=metadata)
+
+ class Mixin(object):
+ data = Column(MutableList.as_mutable(ARRAY(Integer)))
+
+ class Foo(Mixin, Base):
+ __tablename__ = 'foo'
+ id = Column(Integer, primary_key=True)
+
+
class MutableListWithScalarPickleTest(_MutableListTestBase,
fixtures.MappedTest):
ForeignKeyConstraint, PrimaryKeyConstraint, ColumnDefault, Index, event,\
events, Unicode, types as sqltypes, bindparam, \
Table, Column, Boolean, Enum, func, text, TypeDecorator, \
- BLANK_SCHEMA
+ BLANK_SCHEMA, ARRAY
from sqlalchemy import schema, exc
from sqlalchemy.engine import default
from sqlalchemy.sql import elements, naming
typ = MyType()
self._test_before_parent_attach(typ, target_typ, double=True)
+ def test_before_parent_attach_array_enclosing_schematype(self):
+ # test for [ticket:4141] which is the same idea as [ticket:3832]
+ # for ARRAY
+
+ typ = ARRAY(String)
+
+ self._test_before_parent_attach(typ)
+
def test_before_parent_attach_typedec_of_schematype(self):
class MyType(TypeDecorator, sqltypes.SchemaType):
impl = String