Can I iterate through the widgets in a databricks notebook? Something like this pseudocode?
# NB - not valid
inputs = {widget.name: widget.value for widget in dbutuils.widgets}
Yes. You can get all of the widgets returned as a JavaMap. Then you can convert that to a Python dictionary.
%python
my_widgets = dbutils.notebook.entry_point.getCurrentBindings()
{key: my_widgets[key] for key in my_widgets}
Note that "entry_point" is not a supported part of the dbutils
API. Databricks could change or remove it without notice.
i'm not 100% sure but i think so but if not then you might have to manually input the widgets in by them self and not grouped
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.