From 917c901e10e24fed5a19ce192e5a2d899807d14c Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Tue, 16 Jan 2024 00:45:18 +0100 Subject: [PATCH] Types: Add method `ObjectArray.as_generic` AFAIK, it is needed for reverse type lookups. --- src/sqlalchemy_cratedb/type/array.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sqlalchemy_cratedb/type/array.py b/src/sqlalchemy_cratedb/type/array.py index ae68d4b4..a95b8075 100644 --- a/src/sqlalchemy_cratedb/type/array.py +++ b/src/sqlalchemy_cratedb/type/array.py @@ -95,6 +95,8 @@ def __init__(self, left, right, operator=operators.eq): self.operator = operator +# TODO: Should this be inherited from PostgreSQL's +# `ARRAY`, in order to improve type checking? class _ObjectArray(sqltypes.UserDefinedType): cache_ok = True @@ -140,5 +142,8 @@ def any(self, other, operator=operators.eq): def get_col_spec(self, **kws): return "ARRAY(OBJECT)" + def as_generic(self, **kwargs): + return sqltypes.ARRAY + ObjectArray = MutableList.as_mutable(_ObjectArray)