Skip to content
Star
487
Star
487

Databricks

This guide shows you how to simulate a Databricks environment locally using Docker, MinIO as S3-compatible storage, and PostgreSQL as a persistent Hive Metastore. This lab demonstrates how to develop and test Spark and Delta Lake ETLs locally using Databricks Runtime 15.4 LTS (Spark 3.5.0).

  1. Setup Environment:

    Open VS Code in the project folder and execute this command in the Command Palette:

    Terminal window
    > Dev Containers: Reopen in Container
  2. Run the Example:

    Terminal window
    python main.py
  1. Python Script (main.py):
    • Open main.py and set breakpoints.
    • Run the Python: Main configuration from the Run and Debug tab.
  2. Interactive Notebook:
    • Open src/notebooks/analysis.ipynb and debug cells with the Jupyter debugger.
  • All tests: Run the automated script: scripts/run_tests.sh
  • Individually: Use the VS Code Testing tab to run or debug specific test cases.

While a job is running, Open the Spark UI:

Terminal window
http://localhost:4040
Terminal window
docker compose down -v
IssueSolution
Connection RefusedEnsure all services are running: docker compose ps
Table already existsDrop the conflicting table with spark.sql("DROP TABLE IF EXISTS sales.products_silver") or run Clean Up to reset the volumes.