Week 13 - Big Data on Databricks

The lakehouse idea

Workspace & Unity Catalog

PySpark in Databricks

dbt on Databricks

Scheduling dbt Jobs

Practice

Assignment

Gotchas & Pitfalls

Slides (PDF)

Career relevance: Week 13

Glossary: Week 13

History of the Lakehouse

Assignment

The Scenario

Your team already runs the Week 10 taxi mart on Postgres. Leadership wants proof it scales on the shared Databricks lakehouse without rewriting the transformation logic. Your job is to explore the raw data in PySpark, port the dbt project, schedule the build as a Git-backed Databricks Job, and show in numbers why incremental materialization matters at 128M rows.

Read Gotchas & Pitfalls before you start. Most failed submissions trace back to one of those patterns (collect(), >=, or a committed token).

If you worked through Practice, Tasks 1, 2, and 3 reuse the same work with a formal submission layout.

Task 1: PySpark exploration (required)

In a Databricks notebook, read hyf.nyc_yellow.raw_trips into a PySpark DataFrame and answer two questions using only transformations and a single action (show(), not collect() on the raw table):

Then write two or three sentences on when you would reach for PySpark versus dbt SQL for a transformation.

<aside> ๐Ÿ’ก Using AI to help: If your notebook errors on the join or aggregation, paste the traceback and your transformation chain into an LLM and ask it to spot the issue (โš ๏ธ Ensure no tokens, connection strings, or PII are included!). Do not paste raw trip rows.

</aside>

Task 2: dbt on Databricks & incremental models (required)

Port your Week 10 dbt project to Databricks and run fct_trips as an incremental model.

  1. Install dbt-databricks and configure a Databricks target in profiles.yml (token stored as an environment variable, never committed). Copy profiles.yml.example from the assignment repo and keep your real profiles.yml git-ignored.
  2. Confirm dbt debug passes against Databricks.
  3. Change fct_trips to materialized='incremental' with incremental_strategy='merge' and a correct unique_key.
  4. Run dbt build --select fct_trips --full-refresh for the initial full build baseline, followed by dbt build --select fct_trips for the incremental rerun. Capture both wall-clock times and record them in task-2/WRITEUP.md with two or three sentences explaining why the second run was faster (name is_incremental() and the {{ this }} filter explicitly).
  5. Run DESCRIBE HISTORY hyf.dev_yourname.fct_trips in Catalog Explorer or a notebook. Paste the resulting history table (showing CREATE OR REPLACE TABLE and MERGE operations) or include a screenshot link in task-2/WRITEUP.md.

Extra guidelines

Task 3: Schedule a Git-backed dbt Job (required)

Production pipelines run unattended from version-controlled code. Build on Scheduling dbt Jobs by scheduling your ported dbt project directly from your GitHub repository fork:

  1. Push your completed task-2/ dbt project to your GitHub fork of data-assignment-week-13 on branch main.

  2. In Databricks Workflows โ†’ Jobs, create a Job named dev_yourname_fct_trips.

  3. Add a dbt task type and select Git provider as the source:

  1. Configure the task execution:
  1. Click Run now and verify that the run completes with a green checkmark.

  2. Add a schedule (for example, daily at 06:00 UTC) and immediately pause the trigger.

  3. Fill in task-3/SCHEDULING.md with:

Task 4: Optional bonuses

These do not affect whether the assignment passes. Pick any you want for portfolio depth. Each bonus points at a Going Further section so you are not guessing the UI.

Deliverables

<aside> โš ๏ธ Never commit your Databricks token or connection string. Keep them in environment variables, exactly as you did with the Postgres password in Week 12. A committed secret is an automatic fail and a real-world security incident.

</aside>

How to submit

Your work is submitted as a pull request back to the assignment repository:

  1. Fork HackYourFuture/data-assignment-week-13. Your teacher may point you at a cohort fork in the HackYourAssignment organization instead; use whichever link they share.
  2. Clone your fork locally, add your PySpark notebook to task-1/, your dbt project to task-2/, and your scheduling evidence to task-3/. Fill in task-2/WRITEUP.md, task-3/SCHEDULING.md, and AI_ASSIST.md.
  3. Push your changes to branch main on your fork.
  4. Schedule your Databricks Job pointing to https://github.com/<your_username>/data-assignment-week-13.git (branch main, path task-2), confirm a green run, and pause the trigger.
  5. Open a pull request from your fork back to HackYourFuture/data-assignment-week-13.

Expected layout:

data-assignment-week-13/
โ”œโ”€โ”€ task-1/
โ”‚   โ””โ”€โ”€ pyspark_exploration.ipynb    # or exported .py from Databricks
โ”œโ”€โ”€ task-2/
โ”‚   โ”œโ”€โ”€ dbt_project.yml
โ”‚   โ”œโ”€โ”€ models/                      # your ported Week 10 models
โ”‚   โ”œโ”€โ”€ profiles.yml.example         # env_var placeholders only
โ”‚   โ””โ”€โ”€ WRITEUP.md                   # timings, explanation + Delta DESCRIBE HISTORY
โ”œโ”€โ”€ task-3/                          # Git-backed Job scheduling
โ”‚   โ”œโ”€โ”€ SCHEDULING.md                # Jobs vs Airflow write-up + Job Run URL
โ”‚   โ””โ”€โ”€ screenshots/                 # Job config, green run, paused schedule
โ”œโ”€โ”€ task-4/                          # optional bonuses only
โ”‚   โ”œโ”€โ”€ BONUSES.md                   # which bonuses + short notes
โ”‚   โ”œโ”€โ”€ screenshots/                 # e.g. job_notification.png, lineage
โ”‚   โ””โ”€โ”€ pyspark_app/                 # Harder+ only: local transforms + pytest
โ”œโ”€โ”€ .env.example                     # DATABRICKS_* and DBT_SCHEMA template
โ”œโ”€โ”€ AI_ASSIST.md                     # LLM usage notes
โ””โ”€โ”€ README.md

Package your pull request for review

Fill in every section of the PR template (it loads automatically when you open the PR on GitHub). A well-packaged PR includes:

What good looks like


Stuck on collect(), cluster startup, or dbt debug tracebacks? Gotchas & Pitfalls is the first place to look.


The HackYourFuture curriculum is licensed underย CC BY-NC-SA 4.0 *https://hackyourfuture.net/*

CC BY-NC-SA 4.0 Icons

Built with โค๏ธ by the HackYourFuture community ยท Thank you, contributors

Found a mistake or have a suggestion? Let us know in the feedback form.