QuestionQ22

Secure and govern Unity Catalog objects

You have an Azure Databricks workspace enabled for Unity Catalog that contains a managed Delta table named Sales.

Sales stores transaction data and has the following columns:

  • transaction_id (string)
  • transaction_date (date)
  • amount (decimal)

You need to implement these data-quality requirements by using table-level data-quality enforcement:

  • amount must be greater than 0.
  • transaction_id must never be null.

Invalid records must be rejected when they are written to the Sales table.

What should you do?

  • A Use a SELECT statement with WHERE conditions to validate the data before querying.
  • B Create a view that filters out rows where transaction_id is null or amount is less than or equal to 0.
  • C Add a NOT NULL constraint to transaction_id and a CHECK constraint to amount.
  • D Configure row-level security (RLS) where transaction_id is null or amount is less than or equal to 0.
Explanation

A NOT NULL constraint prevents writes with a null transaction_id, and a CHECK constraint requiring amount > 0 rejects rows with zero or negative amounts. These are enforced Delta table constraints; violating either causes the write transaction to fail.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!