Add New Data to Delta Table with Additional Columns
MDFT Academy has a Fabric tenant containing a lakehouse named Lakehousel. The lakehouse contains a Delta table named students with eight columns. You receive new data that contains the same eight columns plus two additional columns.
You create a Spark DataFrame and assign it to a variable named df. The DataFrame contains the new data. You need to add the new data to the Delta table while meeting these requirements:
Keep all existing rows in the table
Ensure all new data is added to the table, including the extra columns
"mergeSchema", "false"
is incorrect. Setting mergeSchema to false would prevent the new columns from being added to the table schema, which would cause the operation to fail since the new data contains additional columns.
"overwriteSchema", "true"
is incorrect. Using overwriteSchema would replace the entire table schema, which could potentially cause data loss and is not the appropriate option for adding new data while preserving existing data.
"overwriteSchema", "false"
is incorrect. Setting overwriteSchema to false would not allow the new columns to be added to the table schema, and would cause the operation to fail since the new data contains additional columns.