Databricks notebooks are interactive, multi-language development environments within the Databricks Data Intelligence Platform, designed for collaborative data engineering, analytics, and machine learning workflows. They combine executable code cells with visualizations, markdown documentation, and real-time collaboration features. Unlike traditional Jupyter notebooks, Databricks notebooks provide native integration with Apache Spark, automatic versioning, built-in Git support, serverless compute, and AI-powered coding assistance through Genie Code—making them production-ready tools for both exploratory analysis and automated data pipelines. Understanding magic commands, dbutils, widgets, and the notebook execution model is essential for maximizing productivity.
What This Cheat Sheet Covers
This topic spans 14 focused tables and 153 indexed concepts, 116 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Notebook Basics and Cell Types
Start here to understand how a notebook actually runs: code versus markdown cells, the keyboard shortcuts that execute them, and the display() function that gives Databricks its richer table and chart rendering. A couple of less-obvious touches live here too — the notebook's default language, per-cell language overrides, and the _sqldf variable that quietly hands a SQL cell's results to the next Python cell.
| Concept | Example | Description | |
|---|---|---|---|
df = spark.read.table("sales")display(df) | • Default cell type that executes code in the notebook's default language (Python, Scala, SQL, or R) • results appear below the cell immediately after execution. | ||
Press Shift+Enter | • Executes current cell and automatically moves focus to the next cell • Ctrl+Enter runs cell without advancing• cells execute sequentially by default. | ||
display(spark.read.parquet("/data"))display(dbutils.fs.ls("/mnt")) | • Databricks-specific function for enhanced table rendering with built-in chart builder and data profile • triggers visualization options for DataFrames • shows formatted tables for dbutils commands. | ||
Click Run All button | • Executes all cells from top to bottom • on DBR 14.0+ runs as a batch workflow and halts on first error • cells with %skip are excluded. | ||
display(df) returns interactive table | • Rendered results below cell • supports tables, charts, HTML, images, and text • output persists in IPYNB format when output commits are enabled. | ||
%md# Sales ReportData updated: 2026-04-20 | • Creates formatted documentation using Markdown syntax • supports headings, lists, tables, images, and inline code for narrative explanations. | ||
Created as Python notebook | • Language assigned when notebook is created • determines which language cells execute without magic commands • changeable via File → Change default cell language. | ||
%sqlSELECT * FROM sales WHERE region = 'West' | • Executes cell in specified language regardless of notebook default • supports %python, %scala, %sql, and %r magic commands at cell start. | ||
Highlight code → Ctrl+Shift+Enter | • Executes only the highlighted lines within a cell without running the full cell • if no text is highlighted, runs the current line • useful for iterating on code quickly. | ||
display(chart)print("summary")display(table_df) | • Python cells support multiple display() calls and print statements in a single cell • all outputs render sequentially below the cell. | ||
Ctrl+V in a Markdown cell | • Paste images directly from clipboard into Markdown cells • also supports drag-and-drop of image files • images stored as notebook attachments. | ||
%sql SELECT * FROM salesNext cell: _sqldf.filter("amount > 100") | • SQL cell results automatically available as a DataFrame named _sqldf in subsequent Python and SQL cells • enables cross-language data sharing without temp views. |