Skip to content

Test for pd.to_sql column error if data contains -np.inf #34493

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 46 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
dbd141a
TST: pd.to_sql for dataframes with -np.inf (#34431)
arw2019 May 31, 2020
70f3e12
DOC: updated what's new (#34431)
arw2019 May 31, 2020
b395497
DOC: improved entry (#34431)
arw2019 Jun 1, 2020
f76e5d3
TST: moved to _TestSQLAlchemy + added round trips
arw2019 Jun 1, 2020
b205b1f
TST: rename + add comment with GH issue #
arw2019 Jun 1, 2020
3c91ce1
TST: rewrote using pytest.mark.parametrize for arg to DataFrame
arw2019 Jun 1, 2020
d3937ef
TST: removed underscore from _input
arw2019 Jun 1, 2020
a836965
DOC: added double backtick to np.inf & removed extraneous space
arw2019 Jun 1, 2020
dfbf1c7
TST: pd.to_sql for dataframes with -np.inf (#34431)
arw2019 May 31, 2020
5a5ce91
DOC: updated what's new (#34431)
arw2019 May 31, 2020
45f2f1e
DOC: improved entry (#34431)
arw2019 Jun 1, 2020
e5e500b
TST: moved to _TestSQLAlchemy + added round trips
arw2019 Jun 1, 2020
e78cf40
TST: rename + add comment with GH issue #
arw2019 Jun 1, 2020
e006731
TST: rewrote using pytest.mark.parametrize for arg to DataFrame
arw2019 Jun 1, 2020
1a312df
TST: removed underscore from _input
arw2019 Jun 1, 2020
8e55729
DOC: added double backtick to np.inf & removed extraneous space
arw2019 Jun 1, 2020
69b814c
Merge branch 'master' into test-to_sql-column-error-npinf
arw2019 Jun 8, 2020
6677c9e
Merge branch 'master' into test-to_sql-column-error-npinf
arw2019 Jun 20, 2020
9dfea80
mergaed with master
arw2019 Jun 23, 2020
51b2c6a
BUG: add catch for MySQL error with np.inf
arw2019 Jun 23, 2020
cc6d53b
use regex for string match + add runtime import
arw2019 Jun 23, 2020
e882228
clean up regex
arw2019 Jun 23, 2020
9c828cc
TST: update to catch error for -np.inf with MySQL
arw2019 Jun 23, 2020
7c0a49c
DOC: resolved conflict in whatsnew
arw2019 Jun 23, 2020
030b9fc
TST: update test_to_sql_with_neg_npinf
arw2019 Jun 23, 2020
9e63a80
fixed error handler syntax in SQLDatabase.to_sql
arw2019 Jun 24, 2020
550c110
fixed error handler syntax in SQLDatabase.to_sql
arw2019 Jun 24, 2020
fe6dbf0
TST: added an xfail test for npinf entries with mysql
arw2019 Jun 24, 2020
57e7403
fixed imports
arw2019 Jun 24, 2020
97f7918
added reference to GH issue
arw2019 Jun 24, 2020
2f24c9b
merge with master
arw2019 Jun 24, 2020
a7fc493
fixed test_to_sql_with_npinf error catch
arw2019 Jun 24, 2020
fa4e929
fixed spelling error in message (can not -> cannot)
arw2019 Jun 24, 2020
cb81d5c
DOC: added info re MySQL ValueError to whatsnew
arw2019 Jun 24, 2020
c8d9c9e
fixed variable name in to_sql
arw2019 Jun 24, 2020
d5ce174
Merge branch 'master' into test-to_sql-column-error-npinf
arw2019 Jun 24, 2020
7128d10
replaced sqlalchemy's dialect.name with flavor
arw2019 Jun 24, 2020
47b2568
merge upstream
arw2019 Jun 24, 2020
3b7c162
fixed typo in test_to_sql-with-npinf
arw2019 Jun 24, 2020
89b055c
Merge branch 'master' into test-to_sql-column-error-npinf
arw2019 Jun 25, 2020
e00206e
Merge branch 'master' into test-to_sql-column-error-npinf
arw2019 Jun 26, 2020
4a3a9a2
merge with master
arw2019 Jun 26, 2020
127a118
merge with master
arw2019 Jun 26, 2020
61d6f33
Merge branch 'master' into test-to_sql-column-error-npinf
arw2019 Jun 30, 2020
2709817
merge with master
arw2019 Jun 30, 2020
656b0f2
resolve conflict
arw2019 Jun 30, 2020
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
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ I/O
- Bug in :meth:`~DataFrame.read_feather` was raising an `ArrowIOError` when reading an s3 or http file path (:issue:`29055`)
- Bug in :meth:`~DataFrame.to_excel` could not handle the column name `render` and was raising an ``KeyError`` (:issue:`34331`)
- Bug in :meth:`~SQLDatabase.execute` was raising a ``ProgrammingError`` for some DB-API drivers when the SQL statement contained the `%` character and no parameters were present (:issue:`34211`)
- Bug in :meth: in earlier versions `pd.to_sql` was raising an error when reading DataFrames with `-np.inf` entries; added test (:issue: `34431`)

Plotting
^^^^^^^^
Expand Down
7 changes: 7 additions & 0 deletions pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,13 @@ class DummyException(Exception):
res2 = self.pandasSQL.read_query("SELECT * FROM test_trans")
assert len(res2) == 1

def _to_sql_with_negative_npinf(self):
engine = sqlalchemy.create_engine("sqlite://", echo=False)

pd.DataFrame({"foo": [np.inf]}).to_sql("foobar1", engine)
pd.DataFrame({"foo": [-np.inf]}).to_sql("foobar2", engine)
pd.DataFrame({"foo": [-np.inf], "infe0": ["bar"]}).to_sql("foobar3", engine)


# -----------------------------------------------------------------------------
# -- Testing the public API
Expand Down