Overwriting Delta Table Using SQL

User16752241457
Databricks Employee
Databricks Employee

I have a delta table that is updated nightly, that I drop and recreate at the start of each day. However, this isn't ideal because every time I drop the table I lose all the info in the transaction log. Is there a way that I can do the equivalent of:

df.write.format('delta').mode('overwrite').save(PATH)

in SQL?

Ryan_Chynoweth
Databricks Employee
Databricks Employee

I think you are looking for the INSERT OVERWRITE command in Spark SQL. Check out the documentation here: https://docs.databricks.com/spark/latest/spark-sql/language-manual/sql-ref-syntax-dml-insert-overwri...