cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
cancel
Showing results for 
Search instead for 
Did you mean: 

Call a workspace notebook from a repository notebook

LJacobsen
New Contributor II

We have a Databricks workspace with several repositories. We'd like to have a place with shared configuration variables that can be accessed by notebooks in any repository.

I created a folder named Shared under the root workspace and in that folder, created a notebook named shared_configuration containing the common configuration values.

2023-10-04_14-46-04.png

 I am not able to call this notebook from notebooks within a repository. I've tried many variations of the path to the notebook but it always results in the error 

Notebook not found: '{notebook path}'. Notebooks can be specified via a relative path (./Notebook or ../folder/Notebook) or via an absolute path (/Abs/Path/to/Notebook). Make sure you are specifying the path correctly. 

LJacobsen_0-1696456391781.png

Is it possible to invoke a workspace notebook from inside a repository, and if so what is the correct syntax to do so?

Alternatively, is there some other recommended way to store common variables in a Databricks workspace that are accessible to notebooks in repositories?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Kaniz
Community Manager
Community Manager

Hi @LJacobsenyou cannot directly call a workspace notebook from inside a repository in Databricks.

The error message you're seeing suggests that Databricks cannot find the notebook you're trying to reference, possibly because it's looking within the current repository rather than the entire workspace.

Alternatively, you could use DBFS (Databricks File System) to store and access shared configuration variables. You can keep your configuration file in DBFS and then read it in any notebook, regardless of its repository. You can use the dbutils.fs.put command to keep the file and dbutils.fs.head to read the file.

View solution in original post

2 REPLIES 2

Kaniz
Community Manager
Community Manager

Hi @LJacobsenyou cannot directly call a workspace notebook from inside a repository in Databricks.

The error message you're seeing suggests that Databricks cannot find the notebook you're trying to reference, possibly because it's looking within the current repository rather than the entire workspace.

Alternatively, you could use DBFS (Databricks File System) to store and access shared configuration variables. You can keep your configuration file in DBFS and then read it in any notebook, regardless of its repository. You can use the dbutils.fs.put command to keep the file and dbutils.fs.head to read the file.

LJacobsen
New Contributor II

Thanks, I was able to implement a solution by storing a json file containing the shared config settings in the DBFS.