Databricks Data Engineer Professional · Section 3 · 12% of the exam
Implement data quality expectations in Lakeflow Pipelines to quarantine, drop, or fail on bad records.
One of the objectives of the Databricks Certified Data Engineer Professional exam, in the section “Data Manipulation”. Here is what it covers, the points to remember and a question to try.
What it covers
Enrich and classify data inside pipelines with task-specific AI functions and ai_query (structured output, error handling, cost control), then guard every layer with Lakeflow Pipelines expectations that warn, drop, fail or route bad records to a quarantine table.
Points to remember
- Task-specific AI Functions (ai_classify, ai_extract, ai_analyze_sentiment, ai_summarize, ai_translate, ai_mask, ai_parse_document...) vs general-purpose
ai_querywith any endpoint. - AI Functions need DBR 15.4 LTS+ or a Pro/serverless SQL warehouse (not Classic) in a supported region; the owner needs CAN QUERY on the endpoint.
- ai_classify/ai_extract v2.x take JSON-string labels or schemas and return VARIANT; pin
map('version', '2.1'). responseFormatforces structured output and returns a JSON string to parse;failOnError => falsereturns STRUCT(response, errorMessage).- Batch inference: one query over the full dataset, Databricks-hosted foundation models; cost shows in system.billing.usage; score each row once with a streaming table.
Try a question
Silver orders must never contain rows with a NULL order_id or a non-positive amount, the pipeline must keep running when such rows arrive, and the data stewards must be able to review every rejected row. What should the data engineer implement?
- A
expect_all_or_failwith both rules, so the stewards are alerted by each failed update - BFlag rows with the inverted rules, then route valid rows to silver and flagged rows to a quarantine table
- C
expect_all_or_dropwith both rules, and the stewards query the dropped rows from the pipeline's event log - DA Delta CHECK constraint on silver, so invalid rows are rejected and listed in the table history
Show the answer
B. Dropping keeps silver clean, but the dropped rows are only counted, not stored. The quarantine pattern documented by Databricks evaluates the rules (for example with expect_all for metrics), adds an is_quarantined flag from NOT(all rules), and splits the stream into a valid silver table and a quarantine table that stewards can query.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson AI Functions and Data Quality Expectations in Pipelines teaches this objective (about 50 minutes), and 15 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.
More in this section
- Apply advanced data transformations, including window functions, joins, and aggregations, using Spark SQL and PySpark to process large datasets.
- Develop a model and query semi-structured data using the VARIANT data type and related functions (e.g., parse_json, variant_get).
- Apply AI functions, including ai_query, to perform model inference within data pipelines for enrichment and classification tasks.