googleapis / googleapis/google-cloud-python

Array contains operation is not supported

Open
#15,680 1 comment 0 reactions 1 assignee Assigned to @olavloite View on GitHub
api: spanner
Dominant language
Python
Stars
5.4k
Forks
1.8k
Avg merge
3d 4h
Merged PRs (30d)
122

Description

When creating an Array type column, the contains operation is not supported.

### To reproduce

```python
from sqlalchemy import ARRAY, String
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column

class Base(DeclarativeBase):
pass

class Sample(Base):
__tablename__ = "sample_table"
sample_field: Mapped[list[str]] = mapped_column(ARRAY(String(20)), nullable=False)

...

stmt = select(Sample).filter(Sample.sample_field.contains("test"))
```

### Error

```
NotImplementedError: ARRAY.contains() not implemented for the base ARRAY type; please use the dialect-specific ARRAY type
```

Going through the spanner dialect code, I could not find any array type I could import.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.