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

Incompatibility with SQLAlchemy 2.0.0+ #443

Open
PApostol opened this issue Feb 3, 2023 · 10 comments
Open

Incompatibility with SQLAlchemy 2.0.0+ #443

PApostol opened this issue Feb 3, 2023 · 10 comments

Comments

@PApostol
Copy link

PApostol commented Feb 3, 2023

SQLAlchemy 2.0.0 has been released on the 26th of January 2023, and it's incompatible with PyHive for connections to Presto, Trino and Hive:

from sqlalchemy import create_engine
create_engine('presto://foo:bar@host')

# results in

  File "/some/path/pyhive/sqlalchemy_presto.py", line 16, in <module>
    from sqlalchemy.databases import mysql
ModuleNotFoundError: No module named 'sqlalchemy.databases'

Similarly,

from sqlalchemy import create_engine
create_engine('trino://foo:bar@host')

# results in

  File "/some/path/sqlalchemy/util/langhelpers.py", line 366, in load
    "Can't load plugin: %s:%s" % (self.group, name)
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:trino

and

from sqlalchemy import create_engine
create_engine('hive://foo:bar@host')

# results in
  File "/some/path/pyhive/sqlalchemy_hive.py", line 16, in <module>
    from sqlalchemy import processors
ImportError: cannot import name 'processors' from 'sqlalchemy' (/some/path/sqlalchemy/__init__.py)

Pinning SQLAlchemy<2.0.0 resolves the issue.

@james1465
Copy link

james1465 commented Mar 6, 2023

I've added a pull request to fix this:

#447

I'm not able to sign the CLA at the moment, so the pull won't get approved - but the changes are almost trivial - if you inspect the request you can see how it's done.

@PApostol
Copy link
Author

PApostol commented Mar 6, 2023

I've added a pull request to fix this:

#447

I'm not able to sign the CLA at the moment, so the pull won't get approved - but the changes are almost trivial - if you inspect the request you can see how it's done.

Nice work! Although I suspect for complete compatibility there needs to be a fix in pyhive/sqlalchemy_trino.py and pyhive/sqlalchemy_presto.py as well.

@belgacea
Copy link

belgacea commented Jun 9, 2023

Could it be merged please ?

@glungley
Copy link

This PR #448 includes the change and has been merged. But then got reverted here: df03bef

@bkyryliuk what's the situation atm?

@mdeshmu
Copy link
Contributor

mdeshmu commented Jun 20, 2023

I am working on a comprehensive PR to add SQLAlchemy 2.0 Support. Should be ready soon.

@mdeshmu
Copy link
Contributor

mdeshmu commented Jun 27, 2023

PR raised #457

@mdeshmu
Copy link
Contributor

mdeshmu commented Jul 12, 2023

PR #457 is merged.

@mdeshmu
Copy link
Contributor

mdeshmu commented Jul 14, 2023

@PApostol @james1465 @belgacea @glungley

PyHive is now compatible with SQLAlchemy 2.0. See #457
This is released in 0.7.1.dev0. You are requested to test with the dev version and report any bugs in the PyHive GitHub repository before 0.7.1 is released in a month or so.

@PApostol
Copy link
Author

I have tried PyHive 0.7.1.dev0 with SQLAlchemy 2.0.19, it appears to work fine!

@mdeshmu
Copy link
Contributor

mdeshmu commented Aug 19, 2023

PyHive 0.7.0 is released which includes Python 3.11 and SQLAlchemy 2.0 support.

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