Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types: Add method ObjectArray.as_generic #23

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Types: Add method ObjectArray.as_generic
AFAIK, it is needed for reverse type lookups.
amotl committed Jun 25, 2024

Unverified

This user has not yet uploaded their public signing key.
commit 917c901e10e24fed5a19ce192e5a2d899807d14c
5 changes: 5 additions & 0 deletions src/sqlalchemy_cratedb/type/array.py
Original file line number Diff line number Diff line change
@@ -95,6 +95,8 @@
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 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

Codecov / codecov/patch

src/sqlalchemy_cratedb/type/array.py#L146

Added line #L146 was not covered by tests


ObjectArray = MutableList.as_mutable(_ObjectArray)