- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 07:16 AM
I know this is 5+ years late but I would like to add an answer (or work around) to this in case anyone else was looking for the same solution.
What I did was to essentially 'reset' the widget whenever I had to assign (or force) a value to it.
#Cell #1
dbutils.widgets.dropdown("ENVIRONMENT", "DEV", Seq('DEV', 'PROD'))
#Cell #2
dbutils.widgets.removeAll()
# Alternatively
# dbutils.widgets.remove('ENVIRONMENT')
# Cell #3
# ENV = <some logic here>
dbutils.widgets.text('ENVIRONMENT', ENV)Above seems like cheating and messy to be honest but it works for my use case. I leave the 1st cell as is just in case I needed it for interactive debugging within the notebook. After all, cell #1 won't matter once the notebook is plugged into a job/workflow
Honestly, I'm just hoping there is a corresponding <set> method available for widgets alongside the available <get> method.
If there's anyone else out there with a better solution as of 2023, I'm all ears!