Skip to main content
Platform blog

New debugging features for Databricks Notebooks with Variable Explorer

Share this post

Today, we are excited to announce the general availability of the Variable Explorer for Python in the Databricks Notebook. The Variable Explorer allows Databricks users to view at-a-glance all the variables defined in their notebooks, inspect and explore DataFrames in one click, and interactively debug Python code with pdb.

View the variables of your notebook

The Variable Explorer displays all variables available in the notebook session. The name, type, and value are surfaced for all simple variable types.

Variable Explorer with simple variables
Variable Explorer with simple variables

The Variable Explorer also surfaces additional metadata for Spark and Pandas DataFrames. The shape and column names are available at-a-glance, and full view of the schema is available on hover

Variable Explorer with DataFrame info on hover
Variable Explorer with DataFrame info on hover

Inspect DataFrames

The Variable Explorer provides a convenient one-click action to inspect all variables, including DataFrames. You can click on any DataFrame to explore it in a new notebook cell, allowing you to easily visualize or profile it.

Inspect and profile a data frame from the Variable Explorer
Inspect and profile a data frame from the Variable Explorer

Step through debug your code with pdb

The Variable Explorer also allows you to step-through debug Python code leveraging the support for pdb in the Databricks Notebook.

You can set breakpoints with breakpoint() or pdb.set_trace(). When you run the cell, the execution will pause at the breakpoint and the Variable Explorer will automatically update with the state of the notebook at that breakpoint.

You can view the state of the notebook's variables when paused at a breakpoint
You can view the state of the notebook's variables when paused at a breakpoint

You can then step through your code with pdb's debugger controls like continue and the Variable Explorer will be automatically updated as the notebook's state changes.

You can step through debug your code using pdb and observe changes in the Variable Explorer
You can step through debug your code using pdb and observe changes in the Variable Explorer

Try it today

Variable Explorer is enabled by default for Databricks Runtime 12.1 and above. Simply open a Python notebook and start using it today. Learn more in our developer documentation.

Try Databricks for free

Related posts

Platform blog

Introducing Upgrades to Databricks Notebooks - New Editor, Python Formatting, and More

Databricks Notebooks offers a simple, unified environment for anyone building Data and AI products. Today we are excited to introduce updates to the...
Platform blog

Software Engineering Best Practices With Databricks Notebooks

June 25, 2022 by Rafi Kurlansik and Austin Ford in Product
Notebooks are a popular way to start working with data quickly without configuring a complicated environment. Notebook authors can quickly go from interactive...
Company blog

7 Tips to Debug Apache Spark Code Faster with Databricks

October 18, 2016 by Vida Ha in Company Blog
Vida Ha is a lead solution architect at Databricks. She has over a decade of experience building big data applications at Google, Square...
See all Platform Blog posts