Can we delete latest version of delta table in the delta lake?

  delta-lake, pyspark, python

I have a delta table with 4 versions.

DESCRIBE HISTORY cfm —> has 4 versions. 0,1,2,3.

I want to delete version 3 or 2.
How can I achieve this?

i tried

from delta.tables import *
from pyspark.sql.functions import *

deltaTable = DeltaTable.forPath(spark, "path of cfm files")

deltaTable.delete("'version' = '3'") 

This does not delete the version 3.
https://docs.delta.io/0.4.0/delta-update.html says

"delete removes the data from the latest version of the Delta table but does not remove it from the physical storage until the old versions are explicitly vacuumed"

If i have to run vacuum command how to use them on latest dates and not older dates.

Source: Python Questions

LEAVE A COMMENT