Skip to content
BENIBIX Learn

Databricks Notebook

Data🧰 PlatformsData Platforms

Also known as Databricks Notebooks

A web page in Databricks where you write and run code in small cells.

Think of it like

It is like a lab notebook. You write a step, try it, and see what happened right under it.

Example

An analyst loads orders with Python in one cell. In the next cell she switches to SQL and counts orders by country. The chart appears under it.

Why it matters

It is where most Databricks work starts. Engineers, analysts and data scientists all write in it.

Definition

A Databricks notebook is a web page where you write and run code in small blocks called cells. Each cell shows its result, such as a table or a chart, right below it. One notebook can mix Python, SQL, Scala and R. A line like %sql at the top of a cell switches that cell's language. Several people can edit the same notebook at once. To run, it attaches to compute, and a job can run it on a schedule.

Example code

sql
%sql
SELECT country, COUNT(*) AS orders
FROM main.sales.orders
GROUP BY country
One cell. The first line makes it run as SQL, even in a Python notebook.
The notebook is on the left. It runs on the all-purpose cluster below it.

Common mistake

Running cells out of order while testing. The notebook then works for you but fails when a job runs it from top to bottom.

Key takeaways

  1. 1
    Cells. Small blocks, each with its result.
  2. 2
    Many languages. Python, SQL, Scala and R.
  3. 3
    Shared. Several people edit at once.