Hello! Welcome to the first hands-on lesson in our module on building data pipelines.
In our last session, we explored the mechanics of Delta Lake, learning how to perform reliable Create, Read, Update, and Delete (CRUD) operations. Today, we're setting up the digital workshop where you'll put that knowledge into practice. Our goal is to set up a Databricks workspace, create a compute cluster, and execute your first commands in a notebook.
This is a foundational step. By the end of this 30-minute lesson, you will have a live Databricks environment ready for building the ELT pipelines we'll be covering in the rest of this module.
1. A Quick Architectural Overview
Before we jump into the setup, let's look at the big picture. As a software and enterprise architect, you're familiar with system design patterns. Databricks employs a common and powerful one: the separation of a Control Plane and a Data Plane.
- Control Plane: This is the "brain" of Databricks. It includes the web interface you'll be using, your notebooks, workflow schedulers, and metadata management (like the Unity Catalog). When you create a notebook or schedule a job, you are interacting with the Control Plane. In a production setup, this is managed by Databricks in their own cloud account.
- Data Plane: This is the "muscle" where the actual data processing happens. It consists of the Spark clusters that execute your code. When you run a command in a notebook, the Control Plane sends the task to a cluster in the Data Plane to be executed.
For the free Community Edition we'll be using, both planes are hosted by Databricks. In a full enterprise deployment, the Data Plane would reside within your organization's own cloud account (e.g., AWS or Azure), giving you control over data residency and security.
2. Setting Up Your Databricks Environment
We will use the Databricks Community Edition (CE). It's a free, slightly scaled-down version of the platform that is perfect for learning and experimentation.
The following video provides a complete walkthrough of signing up, creating a cluster, and running a notebook. I'll guide you through the key segments. Please follow along to set up your own account.
Databricks Community Edition Tutorial | Complete guide | Creating Cluster, Notebook, Tables
Watch this tutorial from Sarthak Dasgupta to guide you through the entire setup process. We will use it to get your environment up and running.
Please follow along with these steps, pausing the video as needed: Sign Up for Community Edition (1:45 - 3:04): Watch this segment to understand the sign-up process and get a tour of the main user interface. Go to the Databricks Community Edition signup page to create your account. Create Your First Cluster (3:04 - 3:56): A cluster is the set of compute resources that will run your code. Follow the steps in the video to create your first one. Give it a memorable name like 'MyFirstCluster'. It will take a few minutes to start up. Create a Notebook (3:56 - 5:06): While your cluster is starting, follow the video to create a new notebook. A notebook is where you will write and execute your code. Once your cluster is running (it will have a green circle next to its name), attach it to your notebook as shown.
By now, you should have an active Databricks workspace, a running cluster, and an empty notebook attached to that cluster.
Test your understanding!
You've just used the Databricks web interface to create a cluster and a notebook. Which architectural plane (Control or Data) were you primarily interacting with during these setup steps? And which plane is responsible for actually running the code you will write?
Show answer
Your interactions with the web UI to create the cluster and notebook were all within the Control Plane. The Data Plane (your newly created cluster) is responsible for the actual execution of the code.
3. Executing Your First Commands
Now for the final step: running some code. Databricks notebooks are powerful because they allow you to seamlessly mix languages within the same file.
1. Run a Python Command
In the first cell of the notebook you created, type the following Python code:
message = "Hello, Databricks!"
print(message)
To run the cell, you can either click the "Run" button (a play icon) in the top-right of the cell or press Shift + Enter on your keyboard. You should see the output Hello, Databricks! appear below the cell.
2. Run a SQL Command
Databricks notebooks allow you to switch languages for a specific cell using "magic commands". Let's run a SQL query.
Create a new cell by clicking the + icon that appears when you hover below your first cell. In this new cell, type:
%sql
SELECT "Hello from SQL!" AS welcome_message
The %sql at the beginning tells Databricks to interpret this cell's content as SQL. Run the cell, and you will see the output displayed in a structured table format.
Congratulations! You have successfully set up your environment and executed code.
Conclusion
In this lesson, you've moved from theory to practice by building your own data engineering sandbox.
Key Takeaways:
- Databricks is architected with a Control Plane (for management and user interaction) and a Data Plane (for compute and execution).
- The Community Edition provides a free, hands-on environment to learn and experiment with the platform.
- The core components you'll work with are the Workspace (for organizing assets), Clusters (the compute engines), and Notebooks (the interactive coding interface).
- Notebooks support multiple languages, and you can switch between them using magic commands like
%sql.
Your environment is now ready. In our next lesson, we'll step back to design principles and compare the ETL vs. ELT approaches to data pipeline design. This will establish the architectural pattern for the first pipeline you'll build in Databricks.