delta lake in databricks - a consistent "view" of just the last half hour of a stream

Viewed 706

I have consisently updated table from spark structured streaming (kafka source) Written like this (in eachBatch)


parsedDf \
        .select("somefield", "anotherField",'partition', 'offset') \
        .write \
        .format("delta") \
        .mode("append") \
        .option("mergeSchema", "true") \
        .save(f"/mnt/defaultDatalake/{append_table_name}")

I need to keep a fast view on this table for "items inserted in the last half hour" How can this be achieved? I can have a readStream from this table, but what I'm missing is how keep just the "tail" of the stream there

Databricks 7.5 spark 3.

1 Answers

Given that Delta lake does not have materalized views and that Delta Lake time-travel is not relevant as you want the most current data:

Related