From ccb81a6e395eefbb369c4ea813f04afc07954426 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 7798692c..71efca4b 100644 --- a/src/sqlalchemy_cratedb/type/array.py +++ b/src/sqlalchemy_cratedb/type/array.py @@ -96,6 +96,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 @@ -139,5 +141,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)