Skip to content

Commit a47a4a8

Browse files
phoflmroeschke
authored andcommitted
Revert deprecation of con as keyword only arg (pandas-dev#54750)
1 parent a9cf640 commit a47a4a8

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

doc/source/whatsnew/v2.1.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ Other Deprecations
586586
- Deprecated the use of non-supported datetime64 and timedelta64 resolutions with :func:`pandas.array`. Supported resolutions are: "s", "ms", "us", "ns" resolutions (:issue:`53058`)
587587
- Deprecated values ``"pad"``, ``"ffill"``, ``"bfill"``, ``"backfill"`` for :meth:`Series.interpolate` and :meth:`DataFrame.interpolate`, use ``obj.ffill()`` or ``obj.bfill()`` instead (:issue:`53581`)
588588
- Deprecated the behavior of :meth:`Index.argmax`, :meth:`Index.argmin`, :meth:`Series.argmax`, :meth:`Series.argmin` with either all-NAs and ``skipna=True`` or any-NAs and ``skipna=False`` returning -1; in a future version this will raise ``ValueError`` (:issue:`33941`, :issue:`33942`)
589-
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.to_sql` except ``name`` (:issue:`54229`)
589+
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.to_sql` except ``name`` and ``con`` (:issue:`54229`)
590590

591591
.. ---------------------------------------------------------------------------
592592
.. _whatsnew_210.performance:

pandas/core/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2801,7 +2801,7 @@ def to_hdf(
28012801

28022802
@final
28032803
@deprecate_nonkeyword_arguments(
2804-
version="3.0", allowed_args=["self", "name"], name="to_sql"
2804+
version="3.0", allowed_args=["self", "name", "con"], name="to_sql"
28052805
)
28062806
def to_sql(
28072807
self,

pandas/tests/io/test_sql.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -2849,13 +2849,14 @@ def setup_driver(cls):
28492849
def test_keyword_deprecation(self):
28502850
# GH 54397
28512851
msg = (
2852-
"tarting with pandas version 3.0 all arguments of to_sql except for the "
2853-
"argument 'name' will be keyword-only."
2852+
"Starting with pandas version 3.0 all arguments of to_sql except for the "
2853+
"arguments 'name' and 'con' will be keyword-only."
28542854
)
28552855
df = DataFrame([{"A": 1, "B": 2, "C": 3}, {"A": 1, "B": 2, "C": 3}])
2856+
df.to_sql("example", self.conn)
28562857

28572858
with tm.assert_produces_warning(FutureWarning, match=msg):
2858-
df.to_sql("example", self.conn)
2859+
df.to_sql("example", self.conn, None, if_exists="replace")
28592860

28602861
def test_default_type_conversion(self):
28612862
df = sql.read_sql_table("types", self.conn)

0 commit comments

Comments
 (0)