From 21e8c04a341d36d13cb8e9b016db34e8f1287903 Mon Sep 17 00:00:00 2001 From: Eduardo Schettino Date: Sat, 9 Jun 2018 19:15:07 +0800 Subject: [PATCH] ENH: to_sql() add parameter "method". Fix docstrings (#8953) --- pandas/io/sql.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pandas/io/sql.py b/pandas/io/sql.py index a0a21ae0ae4f0..5b4b7a9b5e1ec 100644 --- a/pandas/io/sql.py +++ b/pandas/io/sql.py @@ -580,16 +580,20 @@ def _execute_insert(self, conn, keys, data_iter): Parameters ---------- - data : list of list - of values to be inserted + conn : sqlalchemy.engine.Engine or sqlalchemy.engine.Connection + keys : list of str + Column names + data_iter : generator of list + Each item contains a list of values to be inserted """ data = [{k: v for k, v in zip(keys, row)} for row in data_iter] conn.execute(self.table.insert(), data) def _execute_insert_multi(self, conn, keys, data_iter): - """Alternative to _exec_insert for DBs that support multivalue INSERT. + """Alternative to _execute_insert for DBs support multivalue INSERT. - Note: multi-value insert is usually faster for a few columns + Note: multi-value insert is usually faster for analytics DBs + and tables containing a few columns but performance degrades quickly with increase of columns. """ data = [{k: v for k, v in zip(keys, row)} for row in data_iter]