Skip to content

Commit

Permalink
docs: add warning in 'to_sql'
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcrocetti committed Jan 3, 2025
1 parent c00298a commit 4c8fcda
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2795,6 +2795,12 @@ def to_sql(
Databases supported by SQLAlchemy [1]_ are supported. Tables can be
newly created, appended to, or overwritten.
.. warning::
The pandas library does not attempt to sanitize inputs provided via a to_sql call.
Please refer to the documentation for the underlying database driver to see if it
will properly prevent injection, or alternatively be advised of a security risk when
executing arbitrary commands in a to_sql call.
Parameters
----------
name : str
Expand Down
6 changes: 6 additions & 0 deletions pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,12 @@ def to_sql(
"""
Write records stored in a DataFrame to a SQL database.
.. warning::
The pandas library does not attempt to sanitize inputs provided via a to_sql call.
Please refer to the documentation for the underlying database driver to see if it
will properly prevent injection, or alternatively be advised of a security risk when
executing arbitrary commands in a to_sql call.
Parameters
----------
frame : DataFrame, Series
Expand Down

0 comments on commit 4c8fcda

Please sign in to comment.