I am trying to merge an pyspark df (which I set up like this self.df.createOrReplaceTempView("df"))
and a delta table, that is saved at
path = '`/example/example/example/`'
The path is working and the TempView also.
I am getting following error:
mismatched input 'NOT' expecting {<EOF>, ';'}(line 1, pos 981)
When using my acutal path pos 981 points between WHEN[]NOT in the last line.
I think I checked all the commas, all the " and tried to find a similiar example here on stackoverflow but I must be missing something... Can someone point me to where I went wrong?
self.spark.sql(f"MERGE INTO delta.{path} USING df "
f"ON (delta.{path}.a= df.a"
f"and delta.{path}.b= df.b) "
f"WHEN MATCHED THEN UPDATE SET "
f"delta.{path}.c= df.c,"
f"delta.{path}.d= df.d,"
f"delta.{path}.e= df.e, "
f"delta.{path}.a= df.c,"
f"delta.{path}.b= df.d"
f"WHEN NOT MATCHED THEN INSERT * ")