Rana Maninder Singh
Lesson 6 of 12Cloud Data & AI Engineering

Databricks and Big Data Processing

Lesson opener

In one line: Spark does not compute a transformation until an action asks for a result. A notebook cell that only filters has not written the file yet.

Why it matters: Northline's stock transform "ran" in a notebook. The curated path is empty. The cell built a plan and never wrote it. A second run on a different cluster runtime changes a date parse. Figures are illustrative.

Before this lesson: You know raw, curated, and published paths, and you know a SQL report is not the same as a file transform.

What you will be able to do

Prerequisites

Lessons 3 to 5. You can read a short Python function. You do not need a Databricks workspace for the practice.

What runs the job

Azure Databricks is a managed Spark platform on Azure (https://learn.microsoft.com/en-us/azure/databricks/introduction/). A notebook is where a person explores. A job is the scheduled run you trust for curated data. Exploration in a notebook is not the production write.

Spark runs a driver that coordinates and executors that do the work. A transformation describes a change. An action asks for a result and is when the work runs (https://spark.apache.org/docs/latest/rdd-programming-guide.html). filter is a transformation. A write to the lake, or a count you wait for, is an action.

Databricks Runtime is the Spark and library set on the cluster. Pin it on the job. "Latest" is how a Monday parse changes without a code change. This lesson does not name a runtime number. The pin is the control. The number comes from the runtime you tested.

The medallion layout (bronze, silver, gold) is a Databricks convention for raw, cleaned, and consumption data (https://docs.databricks.com/aws/en/lakehouse/medallion). Northline maps bronze to raw/, silver to curated/, and gold to published/. Those names are a convention, not a resource type in the Azure portal.

def curated_rows(rows):
    return [r for r in rows if r.get("sku") and r.get("as_of")]

rows = [
    {"sku": "FX-100", "as_of": "2026-09-30", "units": 80},
    {"sku": "", "as_of": "2026-09-30", "units": 5},
    {"sku": "FX-100", "units": 80},
]
kept = curated_rows(rows)
assert len(kept) == 1
assert kept[0]["sku"] == "FX-100"

The function is the rule. On Spark, the same rule is a transformation until a write action lands curated/stock/.

Teacher walkthrough: drop the blank SKU

All figures are illustrative.

  1. Bronze file: raw/stock/2026-09-30/stock.csv, already past the factory count gate.
  2. The job, not an unnamed notebook, filters to rows with sku and as_of.
  3. The write action lands curated/stock/2026-09-30/.
  4. Validation: input rows minus rejected rows equals curated rows. Rejected rows have a reason. FX-100 is present once. The job definition shows a pinned runtime.

A second workplace case

A person uses a notebook to fix one supplier name before a meeting. That cell writes over published/stock/. The next scheduled job replaces the file, and the meeting number disappears. Notebook writes to published paths are not the production path. The job owns curated/ and the publish step owns published/.

Failure example: the plan that never wrote

Symptom: The notebook shows a filtered preview of 99 rows. curated/stock/2026-09-30/ does not exist. The pipeline that expects it fails.

Diagnosis: The filter was a transformation. Nothing in the cell was an action that wrote the lake. The preview computed a sample for the screen. The root cause is a missing write, not a missing cluster.

Correction: Add an action that writes the curated path and then check the file. Schedule that write as a job with a pinned runtime. Leave the notebook for exploration.

Validation: After the job, the curated path exists, the row count is 99, and a second run with the same runtime and the same input produces 99 again.

Guided practice: name the action

Scenario: Raw price rows include blanks in currency. Curated prices must have sku, currency, and as_of. Gold is a monthly table for finance. Figures are illustrative.

Hints:

Complete solution:

The filter that drops blank currencies is a transformation. The write to curated/price/2026-09-30/ is the action that makes it real. A later publish step writes published/price/2026-09/ only after the curated count matches the kept rows. The job definition pins the Databricks Runtime. A notebook may preview. It may not be the only copy of the write. Validation: rejected rows are listed, and one known SKU has a currency in curated and in the source file.

Independent practice

Describe a transform you would schedule.

Acceptance criteria:

Common mistakes

  • Calling a notebook run a production pipeline because it worked once.
  • Using latest as the cluster runtime for a curated write.
  • Writing gold from an interactive cell during a meeting.
  • Treating the medallion names as Azure resources you create in the portal.

Quick check

  1. What is the difference between a transformation and an action?
  2. Why pin the Databricks Runtime?
  3. What does a notebook preview fail to prove?
  4. How does this course map bronze, silver, and gold?
  5. Who writes the published path?

Answers:

  1. A transformation describes work. An action runs it and can write a result.
  2. So a rerun uses the Spark behavior you tested, not whatever "latest" means on Monday.
  3. That the curated file exists. A preview can compute a sample without writing.
  4. Bronze is raw, silver is curated, gold is published. The names are a convention.
  5. The publish step, after curated checks pass. Not an ad hoc notebook cell.

Quiz alignment

The quiz asks you to separate transformations from actions, to pin a runtime without inventing one, and to keep notebook edits off the published path.

Lesson summary

Spark waits until an action. Production writes are jobs with a pinned runtime. Medallion names map onto raw, curated, and published. A preview on the screen is not a file in the lake.

Bridge to the next lesson

The next lesson trains a model in Azure Machine Learning and stops before calling that training a deployment. Bring one curated table you would trust as training input.