title: Generate SQL statements from a Pandas Dataframe
body: <p>I am loading data from various sources (csv, xls, json etc...) into Pandas dataframes and I would like to generate statements to create and fill a SQL database with this data. Does anyone know of a way to do this?</p>
  
  <p>I know pandas has a <code>to_sql</code> function, but that only works on a database connection, it can not generate a string.</p>
  
  <h2>Example</h2>
  
  <p>What I would like is to take a dataframe like so:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  dates = pd.date_range('20130101',periods=6)
  df = pd.DataFrame(np.random.randn(6,4),index=dates,columns=list('ABCD'))
  </code></pre>
  
  <p>And a function that would generate this (this example is PostgreSQL but any would be fine):</p>
  
  <pre><code>CREATE TABLE data
  (
    index timestamp with time zone,
    "A" double precision,
    "B" double precision,
    "C" double precision,
    "D" double precision
  )
  </code></pre>