We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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.
import pandas as pd from sqlalchemy import create_engine, MetaData, Table, Column, Integer, String, MetaData engine = create_engine("postgresql+psycopg2://postgres:postgres@localhost:5432/postgres") meta = MetaData() students = Table( 'students', meta, Column('id', Integer, primary_key = True), Column('name', String), Column('lastname', String), ) meta.create_all(engine) query = "SELECT * FROM students" df = pd.read_sql(sql=query, con=engine) print(df.head())
This is an SQL Alchemy version issue. Works fine with SQLAlchemy == 1.4.46; Does not work with 2.0.0
Traceback (most recent call last): File "C:\Users\DM_wo\Documents\Rich Insight\reports\asana-clockify\slack-notifier\pandas_bug.py", line 7, in <module> monthly_profitability_df = pd.read_sql(sql=query, con=engine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\DM_wo\Documents\Rich Insight\reports\asana-clockify\slack-notifier\venv\Lib\site-packages\pandas\io\sql.py", line 590, in read_sql return pandas_sql.read_query( ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\DM_wo\Documents\Rich Insight\reports\asana-clockify\slack-notifier\venv\Lib\site-packages\pandas\io\sql.py", line 1560, in read_query result = self.execute(*args) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\DM_wo\Documents\Rich Insight\reports\asana-clockify\slack-notifier\venv\Lib\site-packages\pandas\io\sql.py", line 1405, in execute return self.connectable.execution_options().execute(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'OptionEngine' object has no attribute 'execute'
Expected behaviour is that it would return an empty dataframe, as it does with previous versions of SQLAlchemy.
$ python pandas_bug.py Empty DataFrame Columns: [id, name, lastname] Index: []
commit : 8dab54d python : 3.11.1.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22621 machine : AMD64 processor : AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : English_United Kingdom.1252
pandas : 1.5.2 numpy : 1.24.1 pytz : 2022.7.1 dateutil : 2.8.2 setuptools : 65.5.0 pip : 23.0 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : 3.0.7 lxml.etree : None html5lib : None pymysql : None psycopg2 : 2.9.5 jinja2 : None IPython : None pandas_datareader: None bs4 : None bottleneck : None brotli : None fastparquet : None fsspec : None gcsfs : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : 3.1.0 pandas_gbq : None pyarrow : None pyreadstat : None pyxlsb : None s3fs : None scipy : None snappy : None sqlalchemy : 2.0.0 tables : None tabulate : None xarray : None xlrd : None xlwt : None zstandard : None tzdata : None
The text was updated successfully, but these errors were encountered:
duplicate of [#51015]
Sorry, something went wrong.
No branches or pull requests
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
Issue Description
This is an SQL Alchemy version issue. Works fine with SQLAlchemy == 1.4.46; Does not work with 2.0.0
Expected Behavior
Expected behaviour is that it would return an empty dataframe, as it does with previous versions of SQLAlchemy.
Installed Versions
INSTALLED VERSIONS
commit : 8dab54d
python : 3.11.1.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22621
machine : AMD64
processor : AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : English_United Kingdom.1252
pandas : 1.5.2
numpy : 1.24.1
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 65.5.0
pip : 23.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.0.7
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.9.5
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.0
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : 2.0.0
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None
The text was updated successfully, but these errors were encountered: