Skip to content

Commit

Permalink
Types: Add method ObjectArray.as_generic
Browse files Browse the repository at this point in the history
AFAIK, it is needed for reverse type lookups.
  • Loading branch information
amotl committed Jan 15, 2024
1 parent 07bba7b commit 6092c68
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sqlalchemy_cratedb/type/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

0 comments on commit 6092c68

Please sign in to comment.