crate / crate/sqlalchemy-cratedb
SQLAlchemy 2: Type support for patch to `visit_update`
- Dominant language
- Python
- Stars
- 9
- Forks
- 4
- Avg merge
- 6d 12h
- Merged PRs (30d)
- 3
Description
### Introduction
Within the CrateDB-specific statement compiler for SQLAlchemy, there is a patch to support CrateDB's container data types `OBJECT` and `ARRAY`. It is located at `CrateCompilerSA20.visit_update()`.
### About
SQLAlchemy 2 now wants to convert the `crud_params` list to a type-safe variant using `sqlalchemy.cast()`.
```python
# TODO: Complete SA20 migration.
# This is the column name/value joining code from SA20.
# It may be sensible to use this procedure instead of the old one.
text += ", ".join(
expr + "=" + value
for _, expr, value, _ in cast(
"List[Tuple[Any, str, str, Any]]", crud_params
)
)
```
That croaks with:
```python
AttributeError: 'list' object has no attribute '_is_tuple_type'
```
### Code
The relevant code region is this part within `CrateCompilerSA20.visit_update`:
https://github.com/crate/crate-python/blob/2ee91d52f6e07659c54337fe6bb08caf114e7469/src/crate/client/sqlalchemy/compat/core20.py#L116-L146
### Discussion references
- https://github.com/crate/crate-python/pull/488#pullrequestreview-1240001886
Contributor guide
Assessment
This issue has not been assessed yet.