python - insert ignore pandas dataframe into mysql -


i want "insert ignore" entire pandas dataframe mysql. there way without looping on rows?

in dataframe.to_sql see option if_exists 'append' still continue on duplicate unique keys?

consider using temp table (with exact structure of final table) replaced pandas run insert ignore in cursor call:

dataframe.to_sql('mytemptable', con, if_exists ='replace')  cur = con.cursor() cur.execute("insert ignore myfinaltable select * mytemptable") con.commit() 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -