Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2021 10:11 PM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2021 10:17 PM
Please refer to the below widget example using SQL
%sql
DROP VIEW IF EXISTS tempTable;
CREATE temporary view tempTable AS SELECT 'APPLE' as a UNION ALL SELECT 'ORANGE' as a UNION ALL SELECT 'BANANA' as a;
CREATE WIDGET DROPDOWN fruits DEFAULT 'ORANGE' CHOICES SELECT a from tempTablepython example for dropdown with values passed from the table. pass the values from the temp table (in the above example) through data frame df.
df = spark.sql("""select a from tempTable""")
dbutils.widgets.dropdown("fruits3", "ORANGE", [row[0] for row in df.collect()])