cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

Have code stay hidden even when the notebook is copied

DavidKxx
Contributor

When I save a certain Python notebook where I have selected Hide Code and Hide Results on certain cells, those conditions persist.  For example, when I come back the next day in a new session, the hidden material is still hidden.

When the notebook is copied into a new location by a CI/CD process after I have merged it into my main branch in git, the Hide actions seem to have been forgotten by, or never were known to, the copy of the notebook.  That is, when I open the copy, the Code and the Results in those cells is now visible.

Is there a way to save the Hide actions more durably, so they would still be in force even in a copy of the notebook?

1 ACCEPTED SOLUTION

Accepted Solutions

Walter_C
Honored Contributor
Honored Contributor

In Databricks, the 'Hide Code' and 'Hide Results' actions are part of the interactive notebook UI and are not saved as part of the notebook source code. Therefore, these settings won't persist when the notebook is copied or moved to a new location through a CI/CD process.
As per the information, Git operations that alter the notebook source code result in the loss of the notebook state, which includes cell outputs, comments, version history, and widgets. This means that UI state, such as hidden code or results, would not be preserved through a Git operation.

View solution in original post

1 REPLY 1

Walter_C
Honored Contributor
Honored Contributor

In Databricks, the 'Hide Code' and 'Hide Results' actions are part of the interactive notebook UI and are not saved as part of the notebook source code. Therefore, these settings won't persist when the notebook is copied or moved to a new location through a CI/CD process.
As per the information, Git operations that alter the notebook source code result in the loss of the notebook state, which includes cell outputs, comments, version history, and widgets. This means that UI state, such as hidden code or results, would not be preserved through a Git operation.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group