Databricks Data Engineer Professional exam dumps

Databricks Data Engineer Professional practice question 178 of 313

Databricks Certified Data Engineer Professional. Professional level, Databricks. Free question with the correct answer and a full explanation.

Databricks Data Engineer Professional Question 178

Single answer

You are working on a Delta Lake table to store customer orders. To ensure data integrity, you want to prevent records with negative order quantities from being written to the table. Which approach should you take to implement this constraint?

  1. A

    Define a CHECK constraint on the Delta Lake table using SQL.

  2. B

    Use a trigger to validate data before inserting into the Delta Lake table.

  3. C

    Write a Delta Lake table constraint using Python and enforce it programmatically.

  4. D

    Define a NOT NULL constraint on the order quantity column.

Show answer and explanation

Correct answer: A

Explanation

Delta Lake supports CHECK constraints, which allow you to enforce data quality rules declaratively at the table level. In this scenario, a CHECK constraint can be used to prevent writing records with negative order quantities by specifying a condition such as 'order_quantity >= 0'. This approach ensures that only valid data is written to the Delta Lake table.

  • A. Correct.

    This is the correct choice because Delta Lake supports defining CHECK constraints at the table level to enforce conditions like preventing negative values in a column.

  • B. Incorrect.

    Triggers are not supported in Delta Lake; therefore, this is not a valid option for enforcing constraints.

  • C. Incorrect.

    While you could write custom logic in Python to validate data, this is not an efficient or declarative way to enforce constraints in Delta Lake.

  • D. Incorrect.

    A NOT NULL constraint ensures that a column cannot have NULL values, but it does not prevent negative values from being written to the column.

Timed practice exam

Take a Databricks Data Engineer Professional practice test under exam conditions

60 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam