Skip to content

Commit 077e720

Browse files
committed
docs: include option 'delete_rows'
1 parent 10762c6 commit 077e720

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pandas/core/generic.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2788,7 +2788,7 @@ def to_sql(
27882788
con,
27892789
*,
27902790
schema: str | None = None,
2791-
if_exists: Literal["fail", "replace", "append"] = "fail",
2791+
if_exists: Literal["fail", "replace", "append", "delete_rows"] = "fail",
27922792
index: bool = True,
27932793
index_label: IndexLabel | None = None,
27942794
chunksize: int | None = None,
@@ -2825,12 +2825,13 @@ def to_sql(
28252825
schema : str, optional
28262826
Specify the schema (if database flavor supports this). If None, use
28272827
default schema.
2828-
if_exists : {'fail', 'replace', 'append'}, default 'fail'
2828+
if_exists : {'fail', 'replace', 'append', 'delete_rows'}, default 'fail'
28292829
How to behave if the table already exists.
28302830
28312831
* fail: Raise a ValueError.
28322832
* replace: Drop the table before inserting new values.
28332833
* append: Insert new values to the existing table.
2834+
* delete_rows: If a table exists, delete all records and insert data.
28342835
28352836
index : bool, default True
28362837
Write DataFrame index as a column. Uses `index_label` as the column

0 commit comments

Comments
 (0)