Search code examples
pysparkdatabricksazure-databricksdelta-lake

how add records to a partitioned delta table?


I am practicing with the partitioning of a table, I have this

df.write.format("delta").mode("overwrite").partitionBy("Month").save(path)

But I'm not sure how add records, maybe something like this

df2.write.format("delta").mode("append").partitionBy("Month").save(path)

Solution

  • Yes, if you just need to append new records, you need to use append mode instead of overwrite. In future, when you will need to update some records & insert other, then you need to look onto MERGE INTO command.