Databricks Data Engineer Associate Question 417
Single answerYou are managing a Delta Live Tables (DLT) pipeline, and one of the tables is failing to load with the error: 'LIVE keyword is required in CREATE statement.' You inspect the pipeline and notice the following in the notebook for the table creation: CREATE TABLE sales_data AS SELECT * FROM STREAM(input_data). What needs to be corrected to resolve this error?
- A
Replace
CREATE TABLEwithCREATE LIVE TABLE. - B
Remove the
STREAMkeyword from theFROMclause. - C
Use
LIVE.input_datain theFROMclause instead ofinput_data. - D
Change the statement to
CREATE STREAM TABLE sales_data.
Show answer and explanation
Correct answer: A
Explanation
In Delta Live Tables, all table creation statements must use the CREATE LIVE TABLE syntax to define the table as part of the DLT pipeline. The error message clearly states that the LIVE keyword is required in the CREATE statement. The STREAM keyword in the FROM clause is valid when working with streaming data, so no changes are needed there.
- A. Correct.
Correct. In a Delta Live Tables pipeline, the
CREATE LIVE TABLEsyntax is required to define a table in the pipeline. Omitting theLIVEkeyword results in the observed error. - B. Incorrect.
Incorrect. The
STREAMkeyword is valid in theFROMclause when reading streaming data, and removing it would result in an error if streaming data is used. - C. Incorrect.
Incorrect. While
LIVE.input_datais required when referencing other DLT tables, this is not the source of the error in this case. The error specifically pertains to the missingLIVEkeyword in theCREATEstatement. - D. Incorrect.
Incorrect. The
CREATE STREAM TABLEsyntax is not valid in Delta Live Tables. DLT usesCREATE LIVE TABLEfor both batch and streaming tables.