title: Speeding up Pandas to_sql()?
body: <p>I have a <code>1,000,000</code> x <code>50</code> Pandas <code>DataFrame</code> that I am currently writing to a SQL table using:</p>
  
  <p><code>df.to_sql('my_table', con, index=False)</code></p>
  
  <p>It takes an incredibly long time. I've seen various explanations about how to speed up this process online, but none of them seem to work for MSSQL. </p>
  
  <ol>
  <li><p>If I try the method in: </p>
  
  <p><a href="https://stackoverflow.com/questions/31997859/bulk-insert-a-pandas-dataframe-using-sqlalchemy">Bulk Insert A Pandas DataFrame Using SQLAlchemy</a></p>
  
  <p>then I get a <code>no attribute copy_from</code> error. </p></li>
  <li><p>If I try the multithreading method from: </p>
  
  <p><a href="http://techyoubaji.blogspot.com/2015/10/speed-up-pandas-tosql-with.html" rel="noreferrer">http://techyoubaji.blogspot.com/2015/10/speed-up-pandas-tosql-with.html</a></p>
  
  <p>then I get a <code>QueuePool limit of size 5 overflow 10 reach, connection timed out</code> error.</p></li>
  </ol>
  
  <p>Is there any easy way to speed up to_sql() to an MSSQL table? Either via BULK COPY or some other method, but entirely from within Python code?</p>