Skip to content

Commit da17987

Browse files
committed
docs: add warning in 'to_sql'
1 parent 1b759b7 commit da17987

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pandas/core/generic.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,6 +2801,12 @@ def to_sql(
28012801
Databases supported by SQLAlchemy [1]_ are supported. Tables can be
28022802
newly created, appended to, or overwritten.
28032803
2804+
.. warning::
2805+
The pandas library does not attempt to sanitize inputs provided via a to_sql call.
2806+
Please refer to the documentation for the underlying database driver to see if it
2807+
will properly prevent injection, or alternatively be advised of a security risk when
2808+
executing arbitrary commands in a to_sql call.
2809+
28042810
Parameters
28052811
----------
28062812
name : str

pandas/io/sql.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,12 @@ def to_sql(
750750
"""
751751
Write records stored in a DataFrame to a SQL database.
752752
753+
.. warning::
754+
The pandas library does not attempt to sanitize inputs provided via a to_sql call.
755+
Please refer to the documentation for the underlying database driver to see if it
756+
will properly prevent injection, or alternatively be advised of a security risk when
757+
executing arbitrary commands in a to_sql call.
758+
753759
Parameters
754760
----------
755761
frame : DataFrame, Series

0 commit comments

Comments
 (0)