I want to append the Pandas dataframe to an existing table in a sqlite database called \'NewTable\'. NewTable has three fields (ID, Name, Age) and ID is the primary key. My
You can use SQL functionality insert or replace
insert or replace
query=''' insert or replace into NewTable (ID,Name,Age) values (?,?,?) ''' conn.executemany(query, test.to_records(index=False)) conn.commit()