title: Speeding up pandas.DataFrame.to_sql with fast_executemany of pyODBC
body: <p>I would like to send a large <code>pandas.DataFrame</code> to a remote server running MS SQL. The way I do it now is by converting a <code>data_frame</code> object to a list of tuples and then send it away with pyODBC's <code>executemany()</code> function. It goes something like this:</p>
  
  <pre><code> import pyodbc as pdb
  
   list_of_tuples = convert_df(data_frame)
  
   connection = pdb.connect(cnxn_str)
  
   cursor = connection.cursor()
   cursor.fast_executemany = True
   cursor.executemany(sql_statement, list_of_tuples)
   connection.commit()
  
   cursor.close()
   connection.close()
  </code></pre>
  
  <p>I then started to wonder if things can be sped up (or at least more readable) by using <code>data_frame.to_sql()</code> method. I have came up with the following solution:</p>
  
  <pre><code> import sqlalchemy as sa
  
   engine = sa.create_engine("mssql+pyodbc:///?odbc_connect=%s" % cnxn_str)
   data_frame.to_sql(table_name, engine, index=False)
  </code></pre>
  
  <p>Now the code is more readable, but the upload is <strong>at least 150 times slower</strong>...</p>
  
  <p>Is there a way to flip the <code>fast_executemany</code> when using SQLAlchemy?</p>
  
  <p>I am using pandas-0.20.3, pyODBC-4.0.21 and sqlalchemy-1.1.13.</p>