Skip to content

Instantly share code, notes, and snippets.

@KeesCBakker
Created November 9, 2019 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KeesCBakker/895c75e093b79fc9e940080993ad9d6d to your computer and use it in GitHub Desktop.
Save KeesCBakker/895c75e093b79fc9e940080993ad9d6d to your computer and use it in GitHub Desktop.
def upsertToDelta(df, batch_id):
(DeltaTable
.forPath(spark, delta_location)
.alias("t")
.merge(df.alias("s"), "s.kafka_key = t.kafka_key")
.whenMatchedUpdateAll()
.whenNotMatchedInsertAll()
.execute())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment