I have a dataframe that I want to merge back to a SQL table - not merge in the pandas sense, which would be a join, but a SQL merge operation to update/insert records into the table based on a comparison between the dataframe and the table.
There are a few work arounds I can see, such as writing the dataframe to a new table and doing the merge in SQL, or deleting any existing records based on the primary keys and appended the whole dataframe to the table using to_sql - but is there any built in function that would do this sort of merge in python directly?