Databricks Widgets


             Databricks Widgets

Databricks widgets are interactive input components that can be added to notebooks and dashboards to make them more dynamic and user-friendly. They allow users to modify parameters and re-execute code without manually changing the underlying code. This is particularly useful for exploratory data analysis, creating interactive dashboards, and parameterizing notebooks for reuse.

Key benefits of using Databricks widgets:

  • Parameterized Notebooks: Easily create reusable notebooks that can be executed with different inputs.
  • Interactive Dashboards: Build dashboards with interactive elements that allow users to filter, select, and explore data.
  • Simplified Workflow: Avoid hardcoding values and make it easier for non-technical users to interact with data.

Types of Databricks Widgets:

  • Text: Single-line or multi-line text inputs for entering strings.
  • Dropdown: Select from a list of predefined options.
  • Multiselect: Select multiple options from a list.
  • Combobox: A combination of a dropdown and text input for flexible selection.
  • Checkbox: Toggle options on or off.
  • Radio Button: Select a single option from a group of choices.
  • Date: Select a specific date.
  • Time: Select a particular time.
  • Bounded Numeric: Enter a numerical value within a specified range.
  • Unbounded Numeric: Enter any numerical value.

Creating Widgets:

You can create widgets in a notebook using the dbutils. widgets.x methods, where x is the type of widget (e.g., text, dropdown, combobox). Here’s an example:


dbutils. widgets.text(“input_text,” “default value“, “Label”)


This code creates a text input widget with the label “Label,” a default value of “default value,” and stores the input value in the variable input_text.

Using Widgets in Code:

The values entered in widgets can be accessed within your Python or SQL code as regular variables. You can then use these values to filter data, change parameters, or perform other dynamic actions.



import pandas as pd


input_text = dbutils.widgets.text(“input_text“, “default value“, “Label”)

input_text_value = input_text.get()


# Use input_text_value in your code

print(f”You entered: {input_text_value}”)


Accessing Widget Values from SQL:



FROM your_table

WHERE column_name = getArgument(“input_text”) 


Databricks Training Demo Day 1 Video:

You can find more information about Databricks Training in this Dtabricks Docs Link



Unogeeks is the No.1 IT Training Institute for Databricks Training. Anyone Disagree? Please drop in a comment

You can check out our other latest blogs on Databricks Training here – Databricks Blogs

Please check out our Best In Class Databricks Training Details here – Databricks Training

 Follow & Connect with us:


For Training inquiries:

Call/Whatsapp: +91 73960 33555

Mail us at:

Our Website ➜

Follow us:





Leave a Reply

Your email address will not be published. Required fields are marked *