I have a requirement where in my adls gen2 silver table i have to update one of the column based on a condition when the case is matched and if not then it will be default value. The code i am using is as below
spark.sql(f"""MERGE INTO qa.pigeon_silver.ael_events_supply_change
USING (SELECT * FROM material) latestChange
ON latestChange.s3_file_location = qa.pigeon_silver.ael_events_supply_change.s3_file_location
and latestChange.serialnum = qa.pigeon_silver.ael_events_supply_change.serialnum
WHEN MATCHED THEN UPDATE SET qa.pigeon_silver.ael_events_supply_change.materialnum
WHEN NOT MATCHED THEN qa.pigeon_silver.ael_events_supply_change.materialnum = DEFAULT
""")
"materialnum' is the field that i have to update and "material" is the temp view i have created on top of the Dataframe. "ael_events_supply_change" is the silver delta table that i am trying to update.
But the above code is throwing me error. Can someone help me what i am missing here.