When should I use STREAM() when defining a DLT table?

Mado
Valued Contributor II

Hi,

I am a little confused when I should use STREAM() when we define a table based on a DLT table.

There is a pattern explained in the documentation.

CREATE OR REFRESH STREAMING LIVE TABLE streaming_bronze
 
AS SELECT * FROM cloud_files(
 
  "s3://path/to/raw/data", "json"
 
)
 
 
 
CREATE OR REFRESH STREAMING LIVE TABLE streaming_silver
 
AS SELECT * FROM STREAM(LIVE.streaming_bronze) WHERE...
 
 
 
CREATE OR REFRESH LIVE TABLE live_gold
 
AS SELECT count(*) FROM LIVE.streaming_silver GROUP BY user_id

In the above code, "live_gold" is a live able. Since "streaming_silver" is a streaming live table, I expected the last line of the code to be:

AS SELECT count(*) FROM STREAM(LIVE.streaming_silver) GROUP BY user_id

However, STREAM() is not used in the definition of "live_gold".

I was wondering when I should use STREAM() when defining a live table.