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

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

2 REPLIES 2

Walter_C
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.

Alok7661
Visitor

I have faced the issue that notebook is throwing error memory output exceeds 30 MB and its getting failed(Error:run failed with error message The size of the run output (31467502 bytes) exceeds the limit (31457280 bytes).. I have then use this option to "Hide Result" for most of the df then it ran fine . But now I am worrying how this code will be worked when it get deployed to higher env using Git 

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