Skip to content

Commit 4c8fcda

Browse files
committed
docs: add warning in 'to_sql'
1 parent c00298a commit 4c8fcda

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pandas/core/generic.py

+6
Original file line numberDiff line numberDiff line change
@@ -2795,6 +2795,12 @@ def to_sql(
27952795
Databases supported by SQLAlchemy [1]_ are supported. Tables can be
27962796
newly created, appended to, or overwritten.
27972797
2798+
.. warning::
2799+
The pandas library does not attempt to sanitize inputs provided via a to_sql call.
2800+
Please refer to the documentation for the underlying database driver to see if it
2801+
will properly prevent injection, or alternatively be advised of a security risk when
2802+
executing arbitrary commands in a to_sql call.
2803+
27982804
Parameters
27992805
----------
28002806
name : str

pandas/io/sql.py

+6
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)