Closed marksparrish closed 2 years ago
Found the solution - added reset_index() to the df
d6tstack.utils.pd_to_psql(df.reset_index(), str(engine.url), table_name, if_exists='append',sep='\t')
One more thing - I did not have the order correct in my pandas df. Make sure you order your columns correctly or you will get strange results.
I have searched but no luck. I maybe missing the right terms. I have a pre-existing table with a primary key.
I process a bunch of csv files with pandas and then pass it to a function
But I get this error,
I tried adding an 'id' column with df.insert(0,'id','') but then I get this error.
What am I doing wrong? In using pandas.to_sql, I don't need an 'id' column and I use index=false in the call.