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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -486,7 +486,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
12 changes: 11 additions & 1 deletion pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2007,12 +2007,22 @@ def main(connectable):
"input",
[{"foo": [np.inf]}, {"foo": [-np.inf]}, {"foo": [-np.inf], "infe0": ["bar"]}],
)
def test_to_sql_with_negative_npinf(self, input):
def test_to_sql_with_negative_npinf(self, input, request):
# GH 34431

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:
mark = pytest.mark.xfail(reason="GH 36465")
request.node.add_marker(mark)

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