cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

CREATED WIDGET - SQL syntax - how do I specify a label?

eriodega
Contributor

What is the syntax in SQL for creating a widget in a notebook with a label?

This documentation says "The last argument is label, an optional value for the label shown over the widget text box or dropdown."
The one example provided on that page doesn't use a label for the widget. Here are my attempts:

 

 

CREATE WIDGET TEXT some_variable DEFAULT 'a great default' --succeeds, but no label
CREATE WIDGET TEXT some_variable DEFAULT 'a great default' 'some label/description' --syntax error
CREATE WIDGET TEXT some_variable DEFAULT 'a great default' LABEL 'some label/description' --syntax error

 

 

 

1 REPLY 1

nefflev
New Contributor II

Hi @eriodega 

I do not know how it works with sql but a possibility is to use a python cell in your SQL notebook and create it like this:

%python
dbutils.widgets.text("some_name", "a great default", "some label/description")

All the best

 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group