Menu

Databricks course · Lesson 1 of 13

Databricks for Data Engineers

Databricks for Data Engineers: Spark and Delta Lake underneath, workspaces, compute, jobs, medallion pipelines, Unity Catalog and cost control.

  • Intermediate
  • Pillar guide
  • 10 min read
  • Updated Oct 2026
On this page
  1. Where Databricks fits in a data platform
  2. Core concepts
  3. A worked example: an idempotent daily load
  4. Databricks vs Snowflake (the comparison interviewers ask about)
  5. What this course covers
  6. Common beginner mistakes
  7. What interviewers ask
  8. Key takeaway

Databricks is a managed lakehouse platform. Your tables are files in your own cloud storage (S3, ADLS or GCS), stored in the open Delta Lake format. Apache Spark and Databricks SQL read and write them, and Unity Catalog decides who may use which table, column or file. So most of a data engineer’s work on Databricks is ordinary Spark and SQL. The platform adds managed compute, a job scheduler, declarative pipelines, governance and lineage, plus features such as serverless, Photon and predictive optimization that make it cheaper to run.

This page is the course map. It explains where Databricks fits, the handful of concepts every other lesson builds on, a small worked example you can run on a laptop, how Databricks compares with Snowflake, and what interviewers ask.

Where Databricks fits in a data platform

A typical batch-plus-streaming platform has five layers. Databricks covers the middle three and integrates with the rest:

Layer Typical tools Databricks piece
Sources OLTP databases, SaaS APIs, Kafka, files Lakeflow Connect (managed connectors), Kafka readers, Auto Loader
Storage Object storage Delta tables (and Iceberg reads/writes) in your bucket, governed by Unity Catalog
Processing Spark, SQL, dbt Spark on job or serverless compute, Lakeflow Spark Declarative Pipelines, SQL warehouses running dbt
Orchestration Airflow, Dagster, Lakeflow Jobs Lakeflow Jobs (formerly Workflows); Airflow can also trigger Databricks jobs
Serving BI tools, ML, reverse ETL SQL warehouses for BI, OpenSharing (formerly Delta Sharing), model serving

Two facts explain a lot of behaviour you will see. First, the control plane (UI, notebooks, scheduler, APIs) is run by Databricks, while the compute plane runs either in your cloud account (classic clusters) or in Databricks-managed capacity (serverless). Classic clusters take minutes to start because virtual machines are provisioned; serverless starts in seconds. Second, the data never lives “inside Databricks”: dropping the workspace does not delete files in an external location, and other engines can read the same Delta tables.

Core concepts

These are the terms the rest of the course assumes.

  • Workspace. Where notebooks, files, queries, dashboards and Git folders live. Production code belongs in Git, deployed as code with Declarative Automation Bundles (formerly Databricks Asset Bundles).
  • Compute. All-purpose clusters for development; jobs compute or serverless for scheduled pipelines; SQL warehouses for BI and dbt. Billing is in Databricks Units (DBUs) per hour at a rate that depends on the compute type, plus cloud VM cost for classic compute.
  • Databricks Runtime (DBR). A versioned bundle of Spark, Delta Lake, Python and libraries. Pin a long-term support (LTS) version for production jobs.
  • Delta Lake. Parquet data files plus a transaction log (_delta_log) that gives ACID commits, schema enforcement, MERGE, time travel and table maintenance (OPTIMIZE, VACUUM, liquid clustering). Delta is the default table format on Databricks.
  • Medallion layers. Bronze holds raw data as ingested, silver holds cleaned, deduplicated, conformed tables, and gold holds business-level aggregates and dimensional models. Each layer should be rebuildable from the one before.
  • Lakeflow Jobs. A job is a graph of tasks (notebook, Python, SQL, dbt, pipeline, control-flow tasks) with triggers, parameters, retries, alerts and repair runs that re-execute only failed tasks.
  • Lakeflow Spark Declarative Pipelines (formerly Delta Live Tables, DLT). You declare streaming tables and materialized views with data-quality expectations, and the platform handles dependency order, checkpoints and retries.
  • Auto Loader. The cloudFiles streaming source that picks up new files in cloud storage exactly once, with schema inference and evolution.
  • Unity Catalog. One governance layer for the account: a catalog.schema.table namespace, SQL GRANTs to groups and service principals, row filters and column masks, lineage and audit logs in system tables.

A worked example: an idempotent daily load

The pattern behind most Databricks pipelines is “land raw data, then upsert it into a clean Delta table so that re-running the same day changes nothing”. In a Databricks notebook or SQL warehouse it looks like this (Unity Catalog three-part names; prod.sales.orders_bronze is assumed to exist):

CREATE TABLE IF NOT EXISTS prod.sales.orders (
  order_id STRING, customer_id STRING, amount DECIMAL(10,2), order_date DATE, updated_at TIMESTAMP
) CLUSTER BY (order_date);

MERGE INTO prod.sales.orders AS t
USING (
  SELECT order_id, customer_id, try_cast(amount AS DECIMAL(10,2)) AS amount,
         to_date(order_date) AS order_date, updated_at
  FROM prod.sales.orders_bronze
  WHERE ingest_date = :run_date
  QUALIFY row_number() OVER (PARTITION BY order_id ORDER BY updated_at DESC) = 1
) AS s
ON t.order_id = s.order_id
WHEN MATCHED AND s.updated_at > t.updated_at THEN UPDATE SET *
WHEN NOT MATCHED THEN INSERT *;

:run_date is a job parameter, so a backfill is just a run with a different date; QUALIFY keeps one row per key so the MERGE source has no duplicates; and the updated_at guard stops an older replay from overwriting newer data.

The same logic runs locally with open-source PySpark and delta-spark, which is a good way to learn it without a workspace. Running the load twice leaves the table unchanged, and the Delta history shows each commit:

import tempfile
from pyspark.sql import SparkSession, functions as F
from delta import configure_spark_with_delta_pip
from delta.tables import DeltaTable

builder = (SparkSession.builder.master("local[2]").appName("databricks-pillar")
           .config("spark.sql.extensions", "io.delta.sql.DeltaSparkSessionExtension")
           .config("spark.sql.catalog.spark_catalog", "org.apache.spark.sql.delta.catalog.DeltaCatalog")
           .config("spark.sql.shuffle.partitions", "4"))
spark = configure_spark_with_delta_pip(builder).getOrCreate()
path = tempfile.mkdtemp() + "/orders"

bronze = spark.createDataFrame(
    [("o1", "c1", "120.50", "2026-10-01", "2026-10-01 09:00:00"),
     ("o2", "c2", "80.00", "2026-10-01", "2026-10-01 09:05:00"),
     ("o2", "c2", "85.00", "2026-10-01", "2026-10-01 10:00:00")],   # a later correction for o2
    ["order_id", "customer_id", "amount", "order_date", "updated_at"])

def daily_load(raw):
    w = "row_number() OVER (PARTITION BY order_id ORDER BY updated_at DESC)"
    src = (raw.select("order_id", "customer_id",
                      F.expr("try_cast(amount AS DECIMAL(10,2))").alias("amount"),
                      F.to_date("order_date").alias("order_date"),
                      F.to_timestamp("updated_at").alias("updated_at"))
              .withColumn("rn", F.expr(w)).filter("rn = 1").drop("rn"))
    if not DeltaTable.isDeltaTable(spark, path):
        src.limit(0).write.format("delta").save(path)
    (DeltaTable.forPath(spark, path).alias("t")
        .merge(src.alias("s"), "t.order_id = s.order_id")
        .whenMatchedUpdateAll(condition="s.updated_at > t.updated_at")
        .whenNotMatchedInsertAll()
        .execute())

daily_load(bronze)
daily_load(bronze)          # re-run the same day: no changes
rows = spark.read.format("delta").load(path).orderBy("order_id").collect()
print([(r.order_id, str(r.amount)) for r in rows])
assert [(r.order_id, str(r.amount)) for r in rows] == [("o1", "120.50"), ("o2", "85.00")]

history = DeltaTable.forPath(spark, path).history().select("version", "operation").orderBy("version")
print([(r.version, r.operation) for r in history.collect()])
spark.stop()

The history shows a WRITE (table creation) and two MERGE commits; the second one updated nothing. On Databricks you would run daily_load as a job task, parameterised by date, on jobs or serverless compute.

Databricks vs Snowflake (the comparison interviewers ask about)

Both platforms now run SQL warehouses, Python, streaming-style ingestion and governed open tables, so “which is better” has no general answer. The useful differences are in the defaults:

Databricks Snowflake
Starting point Spark and a lakehouse on open files in your storage A managed SQL warehouse on Snowflake-managed storage
Default table format Delta Lake (Iceberg supported) Snowflake native tables (Iceberg tables supported)
Strongest at Large Spark/Python transformations, streaming, ML on the same data SQL-first analytics, low-administration warehousing, data sharing
Compute model Clusters, serverless and SQL warehouses billed in DBUs Virtual warehouses and serverless features billed in credits
Governance Unity Catalog Snowflake RBAC, Horizon governance features

Choose by workload, team skills and existing estate rather than benchmarks. The full comparison is in Snowflake vs Databricks.

What this course covers

Work through the lessons in this order:

  1. Databricks for Data Engineers (this page): where the platform fits, core vocabulary, a worked load.
  2. Databricks Workspace, Jobs and Lakehouse Concepts: control and compute planes, Git folders and bundles, compute types and access modes, Photon, Lakeflow Jobs triggers and parameters, and a runnable medallion pipeline.
  3. Databricks Compute: serverless, classic job and all-purpose clusters, SQL warehouses, access modes, DBU cost, policies, and fixing start-up, library and memory failures.
  4. Unity Catalog and Data Governance Fundamentals: the three-level namespace, securables and privilege inheritance, storage credentials and external locations, volumes, row filters and column masks, tag-based policies, lineage and audit.
  5. Auto Loader and Lakeflow Declarative Pipelines: incremental file ingestion, schema evolution and rescued data, streaming tables, materialized views and expectations.
  6. Declarative Pipelines in Depth: AUTO CDC for SCD Type 1 and 2, snapshots, quarantine tables and the event log.
  7. Lakeflow Jobs: task graphs, parameters, If/else and For each, triggers, retries and repair runs.
  8. Databricks CI/CD: Git folders, Declarative Automation Bundles, the CLI, unit tests and a CI pipeline.
  9. Monitoring, Performance and Cost: system tables, alerts, the query profile, liquid clustering and predictive optimisation.
  10. Sharing and Federation: OpenSharing (formerly Delta Sharing), Clean Rooms and Lakehouse Federation.
  11. Azure Databricks: ADLS Gen2 through access connectors, Entra ID, Key Vault, networking and Azure integrations.
  12. Databricks Certification Guide: what the Associate and Professional exams test and how to prepare.

The storage layer has its own course. Read Data lakes, lakehouses and Delta Lake, then Delta transactions and schema evolution, MERGE and Change Data Feed and OPTIMIZE, Z-ORDER, VACUUM and liquid clustering. Spark itself is covered in Spark architecture and PySpark fundamentals. Revise with the Databricks cheat sheet.

Common beginner mistakes

  1. Running production jobs on an all-purpose cluster. It costs more per DBU, someone can restart it mid-run, and libraries drift. Use jobs compute or serverless and pin the runtime.
  2. Treating notebooks as the deployment unit. Hand-edited production notebooks have no review or rollback. Keep logic in Git, test it, and deploy jobs with bundles.
  3. Non-idempotent writes. mode("append") in a retried task duplicates data. Use MERGE, replaceWhere or overwrite of a bounded partition, keyed by the run date.
  4. Partitioning everything by a high-cardinality column. It creates millions of tiny files. Small tables need no layout tuning; larger ones usually do better with liquid clustering than with hand-picked partitions.
  5. Granting access to individuals and running jobs as people. Grant to groups and run production jobs as service principals, so access survives staff changes.
  6. Assuming code that works on a dedicated cluster works on serverless. Serverless and standard access mode use Spark Connect, so sparkContext, RDDs and some JVM tricks fail there.
  7. Forgetting table maintenance. Streaming and frequent small writes leave small files; enable predictive optimization or schedule OPTIMIZE, and understand what VACUUM removes before shortening retention.

What interviewers ask

Databricks rounds mix platform knowledge with Spark and Delta internals. Expect:

All 50 are in Top 50 Databricks Interview Questions and Answers. Strong answers name the trade-off (cost, latency, operational load) and the failure mode, not just the feature.

Key takeaway

Databricks is Spark and SQL on Delta tables in your own storage, plus managed compute, jobs, pipelines and Unity Catalog. Learn the vocabulary here, then the workspace and jobs, governance, and ingestion lessons in order; write every task so it can be re-run safely, run production on jobs or serverless compute as a service principal, and choose platforms by workload.

By , Data Engineer and Founder of DataDank · Last reviewed Oct 2026 · Describes Databricks as documented in October 2026 (Lakeflow Jobs, Lakeflow Spark Declarative Pipelines, standard and dedicated access modes, Declarative Automation Bundles). Product names change often; check current documentation. The Databricks SQL block needs a workspace and was checked against the documentation, not executed. The local example runs on PySpark 4.2.0 with delta-spark 4.4.0.

Progress is saved in this browser only. No account needed.

Search
Filter by type