cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

Widget value not synchronized after detach/reattach

varni
New Contributor III

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,

1 REPLY 1

Khaja_Zaffer
Contributor

Hello there 

Can you please share the code used for widgets?

also if you change mannually, is it working? (did it worked before?) 

Are you trying to load via some parent notebook?

Waiting for your response. 

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now