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: 

Accept widget value during runtime from user

LJ
New Contributor II

list1 = ('alpha', 'beta', 'gamma', 'eta', 'Theta')

list2 = ('alpha', 'beta')

df1 = spark.createDataFrame(list1, 'String').withColumnRenamed('value', 'dataset')

df2 = spark.createDataFrame(list2, 'String').withColumnRenamed('value', 'dataset')

df = df1.exceptAll(df2)

list_of_values = [data[0] for data in df.collect()]

dbutils.widgets.dropdown("dataset", list_of_values[0], list_of_values)

dataset = dbutils.widgets.get("dataset")

print(dataset)

In above code is there a way to get data from user after widget creation?

1 ACCEPTED SOLUTION

Accepted Solutions

Hubert-Dudek
Esteemed Contributor III

Every time the user change selection in the widget, you get that selection—behavior after the dropdown change you can define in widget settings.

image.png

View solution in original post

1 REPLY 1

Hubert-Dudek
Esteemed Contributor III

Every time the user change selection in the widget, you get that selection—behavior after the dropdown change you can define in widget settings.

image.png

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