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

SQLAlchemy 2: Type support for patch to visit_update #84

Open
Tracked by #74
amotl opened this issue Jan 27, 2023 · 0 comments
Open
Tracked by #74

SQLAlchemy 2: Type support for patch to visit_update #84

amotl opened this issue Jan 27, 2023 · 0 comments

Comments

@amotl
Copy link
Member

amotl commented Jan 27, 2023

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().

# 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:

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

@amotl amotl transferred this issue from crate/crate-python Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant