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: Investigate CompileError: Unconsumed column names #78

Open
amotl opened this issue Jan 27, 2023 · 0 comments
Open

SQLAlchemy: Investigate CompileError: Unconsumed column names #78

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

Parts of the patch remove a sanity check of SQLAlchemy, but that is currently needed to make things work. It can easily reproduced like this.

./bin/test -t test_nested_object_change_tracking
[...]
  File "/path/to/sqlalchemy/sql/compiler.py", line 703, in __init__
    self.string = self.process(self.statement, **compile_kwargs)
  File "/path/to/sqlalchemy/sql/compiler.py", line 748, in process
    return obj._compiler_dispatch(self, **kwargs)
  File "/path/to/sqlalchemy/sql/visitors.py", line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File "/path/to/crate-python/src/crate/client/sqlalchemy/compat/core20.py", line 97, in visit_update
    crud_params_struct = _get_crud_params(
  File "/path/to/crate-python/src/crate/client/sqlalchemy/compat/core20.py", line 405, in _get_crud_params
    raise exc.CompileError(
sqlalchemy.exc.CompileError: Unconsumed column names: characters_name, data['nested']

Discussion references

We've observed it, and talked about it before.

Code references

The patch is the same for all support adapters.

https://github.com/crate/crate-python/blob/183a116afb62ee94717193303fb6dd7bb8821e58/src/crate/client/sqlalchemy/compat/core10.py#L223-L252

https://github.com/crate/crate-python/blob/183a116afb62ee94717193303fb6dd7bb8821e58/src/crate/client/sqlalchemy/compat/core14.py#L295-L324

https://github.com/crate/crate-python/blob/2ee91d52f6e07659c54337fe6bb08caf114e7469/src/crate/client/sqlalchemy/compat/core20.py#L392-L421

@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