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

BUG: Pandas >= 2.2.0and SQLALCHEMY does not work together #57053

Closed
3 tasks done
jkorsvik opened this issue Jan 24, 2024 · 4 comments
Closed
3 tasks done

BUG: Pandas >= 2.2.0and SQLALCHEMY does not work together #57053

jkorsvik opened this issue Jan 24, 2024 · 4 comments
Labels
Compat pandas objects compatability with Numpy or Python functions Dependencies Required and optional dependencies Duplicate Report Duplicate issue or pull request IO SQL to_sql, read_sql, read_sql_query

Comments

@jkorsvik
Copy link

jkorsvik commented Jan 24, 2024

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

Python==3.10.12
pandas==2.2.0
SQLAlchemy==1.4.51
denodo-sqlalchemy==20230818

def sqlalch():
   connection_string = f"denodo://{username}:{urllib.parse.quote(password)}@{host}:{port}/{database}"
   denodo_engine = db.create_engine(connection_string, **kwargs)
   connection = denodo_engine.connect()
   return connection
conn = sqlalch()
pd.read_sql(query, conn)

Issue Description

produces error:
2024-01-24T11:57:31 cursor = self.execute(sql, params)
2024-01-24T11:57:31 File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 2673, in execute
2024-01-24T11:57:31 cur = self.con.cursor()
2024-01-24T11:57:31 AttributeError: 'Connection' object has no attribute 'cursor'

Expected Behavior

Using odbc connection or pandas 2.0 works.
Using the denodo connection directly works.
might be related to: #51015

Installed Versions

commit : fd3f571
python : 3.10.12.final.0
python-bits : 64
OS : Linux
OS-release : 4.14.330-250.540.amzn2.x86_64
Version : #1 SMP Tue Nov 21 09:57:48 UTC 2023
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : C.UTF-8
LANG : C.UTF-8
LOCALE : en_US.UTF-8

pandas : 2.2.0
numpy : 1.25.2
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 59.6.0
pip : 23.3.2
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.9.9
jinja2 : 3.1.3
IPython : None
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : 2023.9.1
gcsfs : None
matplotlib : 3.7.3
numba : 0.58.1
numexpr : None
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : 15.0.0
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : 2023.9.1
scipy : 1.11.4
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.4
qtpy : None
pyqt5 : None

@jkorsvik jkorsvik added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 24, 2024
pankajkoti added a commit to astronomer/astro-sdk that referenced this issue Jan 24, 2024
Fix CI failures.

Limit pandas to <2.2.0 as it breaks our tests. 2.2.0 was released on Jan
20, 2024 and there is an open issue reported for this
pandas-dev/pandas#57053. We are getting the
same error as reported in the issue.

---------

Co-authored-by: Pankaj <pankaj.singh@astronomer.io>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@lithomas1
Copy link
Member

Let's track this in #57049

@lithomas1 lithomas1 added Duplicate Report Duplicate issue or pull request Compat pandas objects compatability with Numpy or Python functions Dependencies Required and optional dependencies IO SQL to_sql, read_sql, read_sql_query and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 24, 2024
@snyderdustin
Copy link

I downgraded pandas from 2.2.0 to 1.5.3 in order get this error to stop.

pip install --force-reinstall -v "pandas==1.5.3"

@VassilisVassiliadis
Copy link

VassilisVassiliadis commented Feb 27, 2024

I think this issue is related to #43585 -- just noticed that there's a different issue tracking the state of this :)

@juice-zohaa-qamar
Copy link

I was also facing the issue with to_sql, downgraded pandas to 1.5.3 and it was resolved. Really need to have this fixed in the latest release of pandas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions Dependencies Required and optional dependencies Duplicate Report Duplicate issue or pull request IO SQL to_sql, read_sql, read_sql_query
Projects
None yet
Development

No branches or pull requests

5 participants