How do I check if existing data in the table and compare it with output table from my script? Then take the data and do the following:
if the data exists do not do anything.
if the new data set has an update new row. delete the old data and replace with new data
if the data does not exist. Append the new data.
For the Pandas to_sql, I do not want to use the “replace” function because I do not want to delete the entire table and replace it.
One is a SQL file and the other is a CSV File. The goal is to compare the sql table and CSV file.
Then do the following:
if the same exact data exists in the CSV and SQL Table no change in the SQL table.
if the new data in the CSV file update the new row in the SQL table. delete the old data in the SQL table and replace with new data in the SQL Table
if the data in the SQL Table does not exist. Append the new data.