DATABRICKS-DATA-ENGINEER-ASSOCIATE practice question 20 of 25
Identify the impact of ON VIOLATION DROP ROW and ON VIOLATION FAIL UPDATE for a constraint violation. A data engineer has created an ETL pipeline using Delta Live table to manage their company travel reimbursement detail, they want to ensure that the if the location details has not been provided by the employee, the pipeline needs to be terminated. How can the scenario be implemented?
Full set: 177 questionsThe goal is to terminate the pipeline if the location column is NULL. The CONSTRAINT clause in Delta Live Tables (DLT) is used to enforce data quality. The EXPECT condition (location != NULL) correctly identifies records where the location is provided. The ON VIOLATION FAIL UPDATE action instructs DLT to stop the entire pipeline update immediately upon encountering a record that violates this expectation (i.e., where location is NULL). This directly implements the requirement to terminate the pipeline on invalid data.
A. CONSTRAINT validlocation EXPECT (location = NULL) This checks for records where the location is NULL, which is the opposite of the desired validation. It also lacks an ON VIOLATION clause, defaulting to DROP ROW, which doesn't terminate the pipeline.
C. CONSTRAINT validlocation EXPECT (location != NULL) ON DROP ROW While the EXPECT clause is correct, ON DROP ROW (or its full syntax ON VIOLATION DROP ROW) will silently discard the invalid record and allow the pipeline to continue processing. This does not meet the requirement to terminate.
D. CONSTRAINT validlocation EXPECT (location != NULL) ON VIOLATION FAIL This option is syntactically incorrect. The valid keyword to fail a pipeline update due to a constraint violation is FAIL UPDATE, not just FAIL. ---
1. Databricks Documentation
"Manage data quality with Delta Live Tables":
Section: "Declare a data quality constraint"
Content: This section details the syntax for defining constraints: CONSTRAINT EXPECT () [ ON VIOLATION { FAIL UPDATE | DROP ROW } ]. It explicitly states that FAIL UPDATE causes the pipeline update to fail when a record violates the constraint. It also clarifies that DROP ROW is the default behavior
which only discards the record. This directly supports option B as the correct method to terminate a pipeline and refutes option C. It also shows that option D is syntactically invalid.
URL: https://docs.databricks.com/en/delta-live-tables/data-quality.html (The specific content is found under the "Declare a data quality constraint" heading).
Keep practicing
Take the free DATABRICKS-DATA-ENGINEER-ASSOCIATE practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DATABRICKS-DATA-ENGINEER-ASSOCIATE practice questions
- Question 1In which of the following scenarios should a data engineer use the MERGE INTO command ins…
- Question 2Which of the following data workloads will utilize a Gold table as its source?
- Question 3A data engineer has developed a data pipeline to ingest data from a JSON source using Aut…
- Question 4Which two components function in the DB platform architecture’s control plane? (Choose tw…
- Question 5Which of the following code blocks will remove the rows where the value in column age is …
- Question 7Which of the following statements regarding the relationship between Silver tables and Br…
