title: Speed up to_sql() when writing Pandas DataFrame to Oracle database using SqlAlchemy and cx_Oracle
body: <p>Using pandas dataframe's to_sql method, I can write a small number of rows to a table in oracle database pretty easily:</p>
  
  <pre><code>from sqlalchemy import create_engine
  import cx_Oracle
  dsn_tns = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=&lt;host&gt;)(PORT=1521))\
         (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=&lt;servicename&gt;)))"
  pwd = input('Please type in password:')
  engine = create_engine('oracle+cx_oracle://myusername:' + pwd + '@%s' % dsn_tns)
  df.to_sql('test_table', engine.connect(), if_exists='replace')
  </code></pre>
  
  <p>But with any regular-sized dataframes (mine has 60k rows, not so big), the code became unusable as it never finished in the time I was willing to wait (definitely more than 10 min). I've googled and searched quite a few times and the closest solution was the answer given by <a href="https://stackoverflow.com/users/2748781/ansonw">ansonw</a> in <a href="https://stackoverflow.com/questions/31997859/bulk-insert-a-pandas-dataframe-using-sqlalchemy">this question</a>. But that one was about mysql, not oracle. As <a href="https://stackoverflow.com/users/2716837/ziggy-eunicien">Ziggy Eunicien</a> pointed out, it did not work for oracle. Any ideas?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here's a sample of rows in the dataframe:</p>
  
  <pre><code>id          name            premium     created_date    init_p  term_number uprate  value   score   group   action_reason
  160442353   LDP: Review     1295.619617 2014-01-20  1130.75     1           7       -42 236.328243  6       pass
  164623435   TRU: Referral   453.224880  2014-05-20  0.00        11          NaN     -55 38.783290   1       suppress
  </code></pre>
  
  <p>and here is the data types for the df:</p>
  
  <pre><code>id               int64
  name             object
  premium          float64
  created_date     object
  init_p           float64
  term_number      float64
  uprate           float64
  value            float64
  score            float64
  group            int64
  action_reason    object
  </code></pre>