title: mismatched input 'NOT' expecting {<EOF>, ';'} using sql merge into
body: <p>I am trying to merge an pyspark df (which I set up like this <code> self.df.createOrReplaceTempView(&quot;df&quot;))</code> and a delta table, that is saved at
  <code>path = '`/example/example/example/`'</code>
  The path is working and the TempView also.
  I am getting following error:
  <code>mismatched input 'NOT' expecting {&lt;EOF&gt;, ';'}(line 1, pos 981)</code>
  When using my acutal path pos 981 points between WHEN[]NOT in the last line.
  I think I checked all the commas, all the &quot; 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?</p>
  <pre><code>self.spark.sql(f&quot;MERGE INTO delta.{path} USING df &quot;
                                 f&quot;ON (delta.{path}.a= df.a&quot;
                                 f&quot;and delta.{path}.b= df.b) &quot;
                                 f&quot;WHEN MATCHED THEN UPDATE SET &quot;
                                 f&quot;delta.{path}.c= df.c,&quot;
                                 f&quot;delta.{path}.d= df.d,&quot;
                                 f&quot;delta.{path}.e= df.e, &quot;
                                 f&quot;delta.{path}.a= df.c,&quot;
                                 f&quot;delta.{path}.b= df.d&quot;
                                 f&quot;WHEN NOT MATCHED THEN INSERT * &quot;)
  </code></pre>