Databricks Data Engineer Professional · Section 1 · 23% of the exam
Develop User-Defined Functions (UDFs) using Pandas, Python, and SQL, including Unity Catalog functions for the given constraints.
One of the objectives of the Databricks Certified Data Engineer Professional exam, in the section “Developing Code for Data Processing using Python and SQL”. Here is what it covers, the points to remember and a question to try.
What it covers
Pick the right kind of user-defined function for a constraint (performance, compute type, governance, dependencies) and write it correctly: session-scoped Python and pandas UDFs in PySpark, and Unity Catalog SQL, Python and batch Python functions that SQL warehouses, jobs and pipelines can share.
Points to remember
- Prefer built-in functions; then SQL UDFs; vectorized pandas or batch UDFs beat row-at-a-time Python UDFs (up to 100x).
- UC functions (
CREATE FUNCTION catalog.schema.fn) are governed, persistent and callable from SQL warehouses; session UDFs (@udf,spark.udf.register) are not. - Python UDFs must handle NULLs; Spark does not guarantee evaluation order or short-circuiting, so guard with
IF/CASE WHEN. - pandas UDF shapes: Series->Series, Iterator->Iterator (expensive setup once), Series->scalar (aggregate, no partial aggregation).
spark.sql.execution.arrow.maxRecordsPerBatchdefaults to 10,000 and has no effect on serverless.
In the course
The lesson UDFs: Python, pandas, SQL and Unity Catalog Functions teaches this objective (about 50 minutes), and 10 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
- Implement scalable Python project structures for Declarative Automation Bundles (formerly Databricks Asset Bundles / DABs) to support modular development and CI/CD integration.
- Apply troubleshooting techniques to dependency conflicts and installation failures for external libraries (PyPI, local wheels, source archives) across serverless, pipeline, and bundle-deployed environments.
- Create production-ready data pipelines for streaming data using Lakeflow Pipelines and Auto Loader.
- Create and automate ETL workloads using Lakeflow Jobs via the UI, API, and CLI.
- Choose between a streaming table and a materialized view for a given latency, cost, and refresh requirement.
- Implement CDC pipelines using AUTO CDC APIs (formerly APPLY CHANGES) in Lakeflow Pipelines, including SCD Type 1 and Type 2 via stored_as_scd_type.
- Choose between Spark Structured Streaming and Apache Spark™ Declarative Pipelines for scalable ETL given operational constraints.
- Create Lakeflow Jobs that use control-flow operators such as If/Else conditions and For Each loops.
- Choose appropriate compute and configuration for environments and dependencies — including serverless compute (serverless environments, dependency management, performance mode), high-memory notebook tasks, and auto-optimization settings (e.g., disallowing retries).
- Develop unit and integration tests using assertDataFrameEqual, assertSchemaEqual, DataFrame.transform, and testing frameworks to ensure code correctness.
- Apply Structured Streaming stateful-processing semantics, including watermarks, output modes, foreachBatch, and checkpoints for fault-tolerant exactly-once state recovery.