I have a table on SQL Server that looks like this, where each row has a unique combination of Event A and Event B.
`Global Rules Table
ID Event 1 | Event 2 | Validated as | Generated as | Generated with score
1 EA1 EB1 Rule Anti-Rule 0.01
2 EA1 EB2 Rule Rule 0.95
3 ... ... ... ... ...
I have another table with a Foreign Key constraint to Global Rules Table called Local Rules Table.
I have a Pandas DataFrame that looks like this
Event 1 | Event 2 | Validated as | Generated as | Generated with score
EA1 EB1 Rule Rule 0.85
EA1 EB2 Rule Rule 0.95
... ... ... ... ...
Since I have this Foreign Key constraint between Local Rules and Global Rules tables I can't use df.to_sql('Global Rules',con,if_exists='replace').
The columns which I want to update in the database based on values in dataframe are Generated as and Generated with score, so what is the best way to only update those columns in database table based on the DataFrame I have? Is there some out of the box function or library which I don't know about?