# Buggy code
def _execute_insert_multi(self, conn, keys, data_iter):
    """Alternative to _execute_insert for DBs support multivalue INSERT.

    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 = [dict(zip(keys, row)) for row in data_iter]
    conn.execute(self.table.insert(data))


# Traceback (TypeError)
INFO  - ==========================================================================
INFO  - Inserting data one per row.
INFO  - Data inserted successfully!
INFO  - ==========================================================================
INFO  - Inserting data with multirow method.
ERROR - Error while inserting data with multirow method:
Traceback (most recent call last):
File "bug_multirow_sqlite.py", line 52, in store_df_data
df.to_sql("financial_data", con=conn, if_exists="append", index=False, method="multi")
File "C:\Users\jconstanzo\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\generic.py", line 2531, in to_sql
dtype=dtype, method=method)
File "C:\Users\jconstanzo\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py", line 460, in to_sql
chunksize=chunksize, dtype=dtype, method=method)
File "C:\Users\jconstanzo\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py", line 1547, in to_sql
table.insert(chunksize, method)
File "C:\Users\jconstanzo\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py", line 686, in insert
exec_insert(conn, keys, chunk_iter)
File "C:\Users\jconstanzo\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py", line 609, in _execute_insert_multi
conn.execute(self.table.insert(data))
TypeError: insert() takes exactly 2 arguments (1 given)
INFO  - ==========================================================================
INFO  - Inserting data with multirow method and chunksize.
ERROR - Error while inserting data with multirow method and chunksize:
Traceback (most recent call last):
File "bug_multirow_sqlite.py", line 64, in store_df_data
df.to_sql("financial_data", con=conn, if_exists="append", index=False, method="multi", chunksize=10)
File "C:\Users\jconstanzo\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\generic.py", line 2531, in to_sql
dtype=dtype, method=method)
File "C:\Users\jconstanzo\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py", line 460, in to_sql
chunksize=chunksize, dtype=dtype, method=method)
File "C:\Users\jconstanzo\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py", line 1547, in to_sql
table.insert(chunksize, method)
File "C:\Users\jconstanzo\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py", line 686, in insert
exec_insert(conn, keys, chunk_iter)
File "C:\Users\jconstanzo\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py", line 609, in _execute_insert_multi
conn.execute(self.table.insert(data))
TypeError: insert() takes exactly 2 arguments (1 given)

# Fixed code
def _execute_insert_multi(self, conn, keys, data_iter):
    data_list = list(data_iter)
    flattened_data = [x for row in data_list for x in row]
    conn.execute(self.insert_statement(num_rows=len(data_list)), flattened_data)