SetTransaction¶
SetTransaction
is an Action defined by the following properties:
- Application ID (i.e. streaming query ID)
- Version (i.e. micro-batch ID)
- Last Updated (optional) (i.e. milliseconds since the epoch)
SetTransaction
is created when:
DeltaSink
is requested to add a streaming micro-batch (forSTREAMING UPDATE
operation idempotence at query restart)
Demo¶
val path = "/tmp/delta/users"
import org.apache.spark.sql.delta.DeltaLog
val deltaLog = DeltaLog.forTable(spark, path)
import org.apache.spark.sql.delta.actions.SetTransaction
assert(deltaLog.snapshot.setTransactions.isInstanceOf[Seq[SetTransaction]])
deltaLog.snapshot.setTransactions