
Ultimate access to all questions.
A data engineer has joined an existing project and they see the following query in the project repository:
CREATE STREAMING LIVE TABLE loyal_customers AS
SELECT customer_id-
FROM STREAM(LIVE.customers)
WHERE loyalty_level = 'high';
CREATE STREAMING LIVE TABLE loyal_customers AS
SELECT customer_id-
FROM STREAM(LIVE.customers)
WHERE loyalty_level = 'high';
Which of the following describes why the STREAM function is included in the query?
A
The STREAM function is not needed and will cause an error.
B
The table being created is a live table.
Explanation:
The STREAM function is included in the query because the table being created is a live table (specifically a streaming live table).
Here's the detailed breakdown:
STREAMING LIVE TABLE: The query creates a STREAMING LIVE TABLE called loyal_customers. This indicates it's a Delta Live Tables (DLT) pipeline that processes streaming data.
STREAM() function: In Delta Live Tables, the STREAM() function is used to read from a streaming source or another streaming table. It tells DLT that the source data should be processed as a stream rather than as a batch.
LIVE.customers: This refers to a table in the current DLT pipeline (the LIVE schema). The STREAM() function is applied to this table to indicate that loyal_customers should be incrementally updated as new data arrives in the customers table.
Why it's needed: Without the STREAM() function, DLT would treat LIVE.customers as a static table and would perform a full refresh each time the pipeline runs. With STREAM(), DLT processes only new or changed data from customers, enabling efficient incremental processing.
Option A is incorrect: The STREAM function is definitely needed and will not cause an error. It's a required component for creating streaming live tables that process data incrementally.
Option B is correct: The STREAM function is included precisely because the table being created is a live table (specifically a streaming live table) that needs to process data incrementally.
Key Concept: In Delta Live Tables, STREAM() is used to indicate streaming processing from a source table, enabling incremental data processing rather than full table refreshes.