From 1b463058e3282c73d0fb361f78e96ecaa23ce9f4 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 11 Apr 2017 10:26:38 -0400 Subject: Set up base ARRAY to be compatible with postgresql.ARRAY. For some reason, when ARRAY was added to the base it was never linked to postgresql.ARRAY. Link the two types and also make base ARRAY the schema event target so that it supports the same features as postgresql.ARRAY. Change-Id: I82fa6c9d2b8c5028dba3a009715f7bc296b2bc0b Fixes: #3964 --- lib/sqlalchemy/dialects/postgresql/array.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'lib/sqlalchemy/dialects/postgresql/array.py') diff --git a/lib/sqlalchemy/dialects/postgresql/array.py b/lib/sqlalchemy/dialects/postgresql/array.py index 98cab9562..009c83c0d 100644 --- a/lib/sqlalchemy/dialects/postgresql/array.py +++ b/lib/sqlalchemy/dialects/postgresql/array.py @@ -5,7 +5,7 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -from .base import ischema_names +from .base import ischema_names, colspecs from ...sql import expression, operators from ...sql.base import SchemaEventTarget from ... import types as sqltypes @@ -114,7 +114,7 @@ CONTAINED_BY = operators.custom_op("<@", precedence=5) OVERLAP = operators.custom_op("&&", precedence=5) -class ARRAY(SchemaEventTarget, sqltypes.ARRAY): +class ARRAY(sqltypes.ARRAY): """PostgreSQL ARRAY type. @@ -248,18 +248,6 @@ class ARRAY(SchemaEventTarget, sqltypes.ARRAY): def compare_values(self, x, y): return x == y - def _set_parent(self, column): - """Support SchemaEventTarget""" - - if isinstance(self.item_type, SchemaEventTarget): - self.item_type._set_parent(column) - - def _set_parent_with_dispatch(self, parent): - """Support SchemaEventTarget""" - - if isinstance(self.item_type, SchemaEventTarget): - self.item_type._set_parent_with_dispatch(parent) - def _proc_array(self, arr, itemproc, dim, collection): if dim is None: arr = list(arr) @@ -311,4 +299,5 @@ class ARRAY(SchemaEventTarget, sqltypes.ARRAY): tuple if self.as_tuple else list) return process +colspecs[sqltypes.ARRAY] = ARRAY ischema_names['_array'] = ARRAY -- cgit v1.2.1