Skip to content

CI: unpin pymysql, sync min version, and skip failing test #40696

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

Merged
merged 14 commits into from
Apr 9, 2021
Merged
2 changes: 1 addition & 1 deletion ci/deps/actions-37-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies:
- google-cloud-bigquery>=1.27.2 # GH 36436
- psycopg2
- pyarrow>=0.15.0
- pymysql<0.10.0 # temporary pin, GH 36465
- pymysql
- pytables
- python-snappy
- python-dateutil
Expand Down
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v1.3.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ Optional libraries below the lowest tested version may still work, but are not c
+-----------------+-----------------+---------+
| pyarrow | 0.15.0 | |
+-----------------+-----------------+---------+
| pymysql | 0.7.11 | |
| pymysql | 0.8.1 | X |
+-----------------+-----------------+---------+
| pytables | 3.5.1 | |
+-----------------+-----------------+---------+
Expand Down
13 changes: 4 additions & 9 deletions pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1592,18 +1592,13 @@ def to_sql(
)
table.create()

from sqlalchemy import exc
from sqlalchemy.exc import SQLAlchemyError

try:
table.insert(chunksize, method=method)
except exc.SQLAlchemyError as err:
# GH34431
msg = "(1054, \"Unknown column 'inf' in 'field list'\")"
err_text = str(err.orig)
if re.search(msg, err_text):
raise ValueError("inf cannot be used with MySQL") from err
else:
raise err
except SQLAlchemyError as err:
# GH 34431 36465
raise ValueError("inf cannot be used with MySQL") from err

if not name.isdigit() and not name.islower():
# check for potentially case sensitivity issues (GH7815)
Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2013,6 +2013,15 @@ def test_to_sql_with_negative_npinf(self, input):
df = DataFrame(input)

if self.flavor == "mysql":
# GH 36465
# The input {"foo": [-np.inf], "infe0": ["bar"]} does not raise any error
# for pymysql version >= 0.10
# TODO: remove this version check after GH 36465 is fixed
import pymysql

if pymysql.VERSION[0:3] >= (0, 10, 0) and "infe0" in df.columns:
return

msg = "inf cannot be used with MySQL"
with pytest.raises(ValueError, match=msg):
df.to_sql("foobar", self.conn, index=False)
Expand Down