summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-04-11 10:26:38 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-04-11 10:49:30 -0400
commit1b463058e3282c73d0fb361f78e96ecaa23ce9f4 (patch)
tree3dc225d6233db6c15c57a5f6941229f92bb101d6 /lib/sqlalchemy/sql
parent5b81dbcfa3888de65fc33b247353b38488199b00 (diff)
downloadsqlalchemy-1b463058e3282c73d0fb361f78e96ecaa23ce9f4.tar.gz
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
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/sqltypes.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py
index 8a114ece6..b8117e3ca 100644
--- a/lib/sqlalchemy/sql/sqltypes.py
+++ b/lib/sqlalchemy/sql/sqltypes.py
@@ -2061,7 +2061,7 @@ class JSON(Indexable, TypeEngine):
return process
-class ARRAY(Indexable, Concatenable, TypeEngine):
+class ARRAY(SchemaEventTarget, Indexable, Concatenable, TypeEngine):
"""Represent a SQL Array type.
.. note:: This type serves as the basis for all ARRAY operations.
@@ -2199,6 +2199,11 @@ class ARRAY(Indexable, Concatenable, TypeEngine):
return operators.getitem, index, return_type
+ def contains(self, *arg, **kw):
+ raise NotImplementedError(
+ "ARRAY.contains() not implemented for the base "
+ "ARRAY type; please use the dialect-specific ARRAY type")
+
@util.dependencies("sqlalchemy.sql.elements")
def any(self, elements, other, operator=None):
"""Return ``other operator ANY (array)`` clause.
@@ -2325,6 +2330,18 @@ class ARRAY(Indexable, Concatenable, TypeEngine):
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)
+
class REAL(Float):