Databricks Data Engineer Professional · Section 1 · 23% of the exam
Develop unit and integration tests using assertDataFrameEqual, assertSchemaEqual, DataFrame.transform, and testing frameworks to ensure code correctness.
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
Lay out a Declarative Automation Bundle so business logic lives in an importable Python package that is built as a wheel and deployed to every target from one codebase, and prove that code correct with pytest, DataFrame.transform, assertDataFrameEqual and assertSchemaEqual before CI/CD promotes it.
Points to remember
- Bundle layout:
databricks.yml+resources/*.ymlfor jobs and pipelines, a package undersrc/<name>/,tests/withconftest.py, andpyproject.toml. default-pythonrequires uv and builds the wheel withartifacts: <key>: {type: whl, build: uv build --wheel};bundle deploybuilds and uploads it.python_wheel_taskneedspackage_nameandentry_point(a[project.scripts]name); on serverless it also needsenvironment_keypointing toenvironments[].spec.- Environment spec:
environment_version(replaces deprecatedclient) and pip-styledependencies, e.g.../dist/*.whl; paths are relative to the declaring YAML file. - Changed wheel, same version can keep running old code: bump the version or use
presets.artifacts_dynamic_version: true.
Try a question
A bundle builds a wheel from pyproject.toml and runs it as a Python wheel task on serverless jobs compute. To simplify local setup, a developer moved pytest and databricks-connect from the [dependency-groups] dev list into [project] dependencies. Since then every run fails while the job environment is set up: the Python session stops with an error right after the packages install. Unit tests still pass locally. What is the best fix?
- APin
databricks-connectto the version that matches the job's environment version, so both clients agree - BSwitch the job environment to the ML base environment, which already ships pytest and Databricks Connect
- CMove both back to the
devgroup, so the wheel no longer pulls Databricks Connect onto serverless - DSet
presets: artifacts_dynamic_version: true, so that serverless installs a freshly versioned wheel each deploy
Show the answer
C. Everything in [project] dependencies becomes a requirement of the wheel, so serverless installs it together with the wheel. Databricks Connect contains its own PySpark, and installing PySpark or a package that brings it in stops a serverless session. The default-python template keeps test-only tools in [dependency-groups] dev, which uv installs locally but never ships with the wheel.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson Bundle Python Projects and Tested Transformation Code teaches this objective (about 55 minutes), and 13 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.
- Develop User-Defined Functions (UDFs) using Pandas, Python, and SQL, including Unity Catalog functions for the given constraints.
- 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).
- Apply Structured Streaming stateful-processing semantics, including watermarks, output modes, foreachBatch, and checkpoints for fault-tolerant exactly-once state recovery.