I would like to know what exactly "overwrite" does here. Let's say I have a table having the following records in table "tb1"(sorry for bad representation of tables)
driver vin make model
martin abc ford escape
john abd toyota camry
amy abe chevrolet malibu
carlos abf honda civic
Now I have the following dataframe(mydf) with the same columns but with the follwing rows/data
martin abf toyota corolla
carlos abg nissan versa
After saving the above dataframe to the "tb1" with overwrite mode, will the dataframe entirely delete the contents of "tb1" and write the data of mydf(above two records)?
However, I would like the overwrite mode to overwrite only those rows that have same values for column "driver". In this case, of 4 records in "tb1", mydf would overwrite only above 2 records and the resultant table would be as follows-
driver vin make model
martin abf toyota corolla
john abd toyota camry
amy abe chevrolet malibu
carlos abg nissan versa
Can I achieve this functionality using overwrite mode?
mydf.write.mode(SaveMode.Overwrite).saveAsTable("tb1")