title: Python Pandas to_sql, how to create a table with a primary key?
body: <p>I would like to create a MySQL table with Pandas' to_sql function which has a primary key (it is usually kind of good to have a primary key in a mysql table) as so:</p>
  
  <pre><code>group_export.to_sql(con = db, name = config.table_group_export, if_exists = 'replace', flavor = 'mysql', index = False)
  </code></pre>
  
  <p>but this creates a table without any primary key, (or even without any index).</p>
  
  <p>The documentation mentions the parameter 'index_label' which combined with the 'index' parameter could be used to create an index but doesn't mention any option for primary keys.</p>
  
  <p><a href="http://pandas.pydata.org/pandas-docs/dev/generated/pandas.DataFrame.to_sql.html" rel="noreferrer">Documentation</a></p>