Databricks Data Engineer Associate Question 394
Single answerYou are working with a Delta table in Databricks that enforces a NOT NULL constraint on a column. You attempt to insert a record that violates this constraint. What is the default behavior of Delta Lake in this scenario?
- A
The operation fails with a validation error.
- B
The record is inserted, and a warning is logged.
- C
The record is silently dropped from the insert operation.
- D
The operation succeeds, and the NOT NULL constraint is ignored.
Show answer and explanation
Correct answer: A
Explanation
Delta Lake enforces constraints such as NOT NULL by default to ensure data integrity. If a record violates a constraint, the operation fails, and a validation error is raised. This behavior aligns with Delta Lake's design principle of providing strong data guarantees.
- A. Correct.
This is correct. Delta Lake's default behavior for constraint violations, such as NOT NULL, is to fail the operation with a validation error.
- B. Incorrect.
This is incorrect. Delta Lake does not allow records violating constraints to be inserted, so no warnings are logged while allowing the operation to proceed.
- C. Incorrect.
This is incorrect. Delta Lake does not silently drop invalid records; it enforces constraints strictly by default.
- D. Incorrect.
This is incorrect. Delta Lake does not ignore constraints; it enforces them by default and raises an error if they are violated.