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 Jun 24, 2024
1 parent 67b2e32 commit 02164f4
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

Check warning on line 146 in src/sqlalchemy_cratedb/type/array.py

View check run for this annotation

Codecov / codecov/patch

src/sqlalchemy_cratedb/type/array.py#L146

Added line #L146 was not covered by tests


ObjectArray = MutableList.as_mutable(_ObjectArray)

0 comments on commit 02164f4

Please sign in to comment.