Skip to content

Commit

Permalink
Need to expose create_pk on the DataFrame.
Browse files Browse the repository at this point in the history
  • Loading branch information
MJuddBooth committed Oct 20, 2023
1 parent b34acc7 commit cfd913c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2834,6 +2834,7 @@ def to_sql(
chunksize: int | None = None,
dtype: DtypeArg | None = None,
method: Literal["multi"] | Callable | None = None,
create_pk: bool = False,
) -> int | None:
"""
Write records stored in a DataFrame to a SQL database.
Expand Down Expand Up @@ -2889,6 +2890,8 @@ def to_sql(
Details and a sample callable implementation can be found in the
section :ref:`insert method <io.sql.method>`.
create_pk : bool, default False
if True, us the index column(s) to create a primary key on the table
Returns
-------
Expand Down Expand Up @@ -3041,6 +3044,7 @@ def to_sql(
chunksize=chunksize,
dtype=dtype,
method=method,
create_pk=create_pk,
)

@final
Expand Down

0 comments on commit cfd913c

Please sign in to comment.