Skip to content

Commit

Permalink
add explanation why conn.execute is used instead of insert.values
Browse files Browse the repository at this point in the history
  • Loading branch information
jacadzaca committed Oct 10, 2023
1 parent 9bdbf8e commit 1667b3c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,10 @@ def _execute_insert_multi(self, conn, keys: list[str], data_iter) -> int:

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

Expand Down

0 comments on commit 1667b3c

Please sign in to comment.