laughingman7743 / PyAthena

PyAthena is a Python DB API 2.0 (PEP 249) client for Amazon Athena.
MIT License
463 stars 105 forks source link

Compatibility issue with SQLAlchemy<1.4 #490

Closed stlee-aurora closed 1 year ago

stlee-aurora commented 1 year ago

Hello! I believe I have encountered a breaking compatibility issue between PyAthena>=3.0 and SQLAlchemy<1.4. My use case currently requires Python 3.10 and SQLAlchemy<1.4, so this issue prevents me from using PyAthena with SQLAlchemy.

A reproducible example: Python version 3.10.12 pyathena==3.0.10 sqlalchemy==1.3.24

When I execute: from pyathena.sqlalchemy.base import AthenaDialect

I receive:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/stlee/venv_test/pyathena/lib/python3.10/site-packages/pyathena/sqlalchemy/base.py", line 39, in <module>
    from pyathena.sqlalchemy.types import AthenaDate, AthenaTimestamp
  File "/home/stlee/venv_test/pyathena/lib/python3.10/site-packages/pyathena/sqlalchemy/types.py", line 15, in <module>
    class AthenaTimestamp(TypeEngine[datetime]):
TypeError: 'VisitableType' object is not subscriptable
laughingman7743 commented 1 year ago

You may want to update SQLAlchemy to 1.4. Or use an older version of PyAthena; the latest version of PyAthena does not support SQLAlchemy 1.3.

If the error occurs in SQLAlchemy 1.4, please register the issue.

stlee-aurora commented 1 year ago

Got it, thanks for the response! I would suggest updating the version requirements for sqlalchemy in the setup configuration.