List all the widgets in NB

Sharukh Kundagol 125 Reputation points
2023-03-02T18:13:29.9166667+00:00

Hi Team,

Is there any command to list all the widgets used in the NB.

My requirement is to log all the widgets used in each NB, since widget changes of each NB if there is some command which will give widget and value used in that NB i can add it All NB

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,080 questions
{count} votes

Accepted answer
  1. PRADEEPCHEEKATLA-MSFT 85,586 Reputation points Microsoft Employee
    2023-03-09T10:09:59.4033333+00:00

    @Sharukh Kundagol Apologies for the inconvenience caused due to the incorrect answer provided above.

    As per the repro, I had found that there is no command called dbutils.widgets.list() in dbutils.widgets module.

    User's image

    Here is the command to log all the widgets used in a notebook:

    # Log all the widgets used in the notebook
    my_widgets = dbutils.notebook.entry_point.getCurrentBindings() 
    {key: my_widgets[key] for key in my_widgets}
    

    You can add this code to each notebook to log all the widgets used in that notebook.

    User's image

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


0 additional answers

Sort by: Most helpful