Description
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
import pandas as pd
import pymssql
conn = pymssql.connect(user=user, password=password, host=host, database=db, as_dict=True, autocommit=True)
result_set = pd.read_sql_query("select * from table", conn)
print(result_set.head())
Issue Description
In the latest version of pandas (v2.0.0), the read_sql_query
function does not seem to work.
I am using a pymssql
connection and when executing a query, the result set is fetched and the number of rows are intact but the column names are duplicated in the cell values.
The functionality works as expected in the v1.5.3
version
The result set looks like this with v2.0.0
(Unexpected Behavior)
Column 1 | Column 2 | Column 3 |
---|---|---|
Column 1 | Column 2 | Column 3 |
Column 1 | Column 2 | Column 3 |
Column 1 | Column 2 | Column 3 |
Expected Behavior
Expected Behavior
Column 1 | Column 2 | Column 3 |
---|---|---|
1 | 4 | 7 |
2 | 5 | 8 |
3 | 6 | 9 |
Installed Versions
INSTALLED VERSIONS
commit : 478d340
python : 3.10.5.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22000
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 12, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_India.1252
pandas : 2.0.0
numpy : 1.24.2
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 58.1.0
pip : 23.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.0.9
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : None
pandas_datareader: None
bs4 : 4.12.0
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None