cloudera / impyla

Python DB API 2.0 client for Impala and Hive (HiveServer2 protocol)
Apache License 2.0
731 stars 248 forks source link

Support new methods in SQLAlchemy 2.0 #512

Open huw0 opened 1 year ago

huw0 commented 1 year ago

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 commented 8 months ago

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: https://github.com/cloudera/impyla/blob/747e1da3d0df6abae9beb633cb9ebdd6f210ad30/impala/sqlalchemy.py#L264

s1lvester commented 7 months ago

This is also related:

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

which stems from here: https://github.com/cloudera/impyla/blob/747e1da3d0df6abae9beb633cb9ebdd6f210ad30/impala/sqlalchemy.py#L231

Versions used:

frbelotto commented 1 month ago

Any solution on it?

csringhofer commented 1 month ago

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 https://github.com/cloudera/impyla/pull/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