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

Support new methods in SQLAlchemy 2.0 #512

Open
huw0 opened this issue May 22, 2023 · 4 comments
Open

Support new methods in SQLAlchemy 2.0 #512

huw0 opened this issue May 22, 2023 · 4 comments

Comments

@huw0
Copy link
Contributor

huw0 commented May 22, 2023

SQLAlchemy 2.0 was released in January and the documentation indicates a number of new functions.

clear_cache
get_materialised_view_names
get_multi_check_constraints
get_multi_columns
get_multi_foreign_keys
get_multi_indexes
get_multi_pk_constraint
get_multi_table_comment
get_multi_table_options
get_multi_unique_constraints
has_index
has_schema
sort_tables_on_foreign_key_dependency

Clearly not all of these are relevant in the context of Impala, but it would be good to stub these functions so that Impala can be used by SQLAlchemy applications that assume these functions are implemented.

Additionally please include the version of SQLAlchemy in the README.

@lazyhope
Copy link

lazyhope commented Mar 1, 2024

With the new SQLAlchemy 2.0 version ImpalaDialect.get_columns is broken, since connection.execute('plain_text') is deprecated and should be replaced with connection.execute(text('plain_text')) where text is imported from sqlalchemy, so this line would fail:

cursor = connection.execute(query)

@s1lvester
Copy link

This is also related:

TypeError: has_table() got an unexpected keyword argument 'info_cache'

which stems from here:

def has_table(self, connection, table_name, schema=None):

Versions used:

  • impyla: v0.19.9
  • sqlalchemy: 20.0.29
  • python: 3.9.18

@frbelotto
Copy link

Any solution on it?

@csringhofer
Copy link
Collaborator

csringhofer commented Oct 9, 2024

With the new SQLAlchemy 2.0 version ImpalaDialect.get_columns is broken, since connection.execute('plain_text') is
deprecated and should be replaced with connection.execute(text('plain_text')

This seems fixed in #538

Additionally please include the version of SQLAlchemy in the README.

Currently SQLAlchemy related tests run with v2 for Python 3.* and v1 with Python2.*, so to some degree both are tested.

I used SQLAlchemy only briefly, so inputs are welcome in this area, for example what to add to https://github.com/cloudera/impyla/blob/master/impala/tests/test_sqlalchemy.py to catch these issues

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

5 participants