Which of the following commands results in the successful creation of a view on top of the delta stream (stream on delta table)?

Which of the following commands results in the successful creation of a view on top of the delta stream (stream on delta table)?
A . Spark.read.format("delta").table("sales").createOrReplaceTempView("streaming_vw")
B. Spark.readStream.format("delta").table("sales").createOrReplaceTempView("streaming_vw ")
C. Spark.read.format("delta").table("sales").mode("stream").createOrReplaceTempView("strea ming_vw")
D. Spark.read.format("delta").table("sales").trigger("stream").createOrReplaceTempView("stre aming_vw")
E. Spark.read.format("delta").stream("sales").createOrReplaceTempView("streaming_vw")
F. You can not create a view on streaming data source.

Answer: B

Explanation:

The answer is

Spark.readStream.table("sales").createOrReplaceTempView("streaming_vw")

When you load a Delta table as a stream source and use it in a streaming query, the query processes all of the data present in the table as well as any new data that arrives after the stream is started.

You can load both paths and tables as a stream, you also have the ability to ignore deletes and changes (updates, Merge, overwrites) on the delta table. Here is more information,

https://docs.databricks.com/delta/delta-streaming.html#delta-table-as-a-source

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments