Hello Databricks Team,
I hope you are doing well.
Iām working with dbutils.widgets in a Databricks notebook using the Accessed Commands mode, and I have encountered some challenges.
Specifically, after detaching and reattaching to the cluster:
- the widgets remain visible in the UI;
- however, their values are no longer properly synchronized with the backend;
- Accessed Commands do not automatically trigger when widget values are changed;
- and in the code, we continue to see the old value, even though the UI shows the updated one.
What we have tried:
- Using Run Notebook mode, but this is not suitable as it executes the entire notebook, whereas we only want specific cells to run.
- Using Do Nothing mode, but this requires manual cell execution, which we want to avoid.
- We have also considered switching to ipywidgets, but are concerned about potential instability or synchronization issues, especially after reattaching.
Our goal:
- Ensure that after detaching/reattaching and changing a widget value, only the relevant cells (Accessed Commands) are executed.
- Make sure the code consistently picks up the updated widget value, without requiring a full notebook rerun or manual intervention.
I would be grateful if you could let us know:
- Is this a known limitation of Databricks widgets?
- Are there any recommended workarounds or best practices to achieve this behavior?
Thank you very much for your time and support.
Best regards,