Skip to content

Commit 1667b3c

Browse files
committed
add explanation why conn.execute is used instead of insert.values
1 parent 9bdbf8e commit 1667b3c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/io/sql.py

+4
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,10 @@ def _execute_insert_multi(self, conn, keys: list[str], data_iter) -> int:
964964

965965
data = [dict(zip(keys, row)) for row in data_iter]
966966
stmt = insert(self.table)
967+
# conn.execute is used here to ensure compatibility with Oracle.
968+
# Using stmt.values(data) would produce a multi row insert that
969+
# isn't supported by Oracle.
970+
# see: https://docs.sqlalchemy.org/en/20/core/dml.html#sqlalchemy.sql.expression.Insert.values
967971
result = conn.execute(stmt, data)
968972
return result.rowcount
969973

0 commit comments

Comments
 (0)