0

I am trying to use pandas and sqlalchemy to write text files into a mysql database.

My code is:

remote_engine = create_engine('mysql://user:password@192.168.1.240/test')

table = pd.read_table('data.csv', sep=',')
table.to_sql('data', remote_engine, if_exists='append')

the if_exists flag doesn't seem to be working though I keep getting

OperationalError 1050 Table 'data' already exists.

isn't if_exists meant to cater for this?

This is using the latest version non dev version of Pandas

KillerSnail
  • 3,321
  • 11
  • 46
  • 64

0 Answers0