Wednesday, February 2, 2022

Databricks Notebook Reference Paths

To reference a notebook from another notebook, you need to give relative path from your current notebook. 

Example: If your working notebook are structured as below:

  1. /Users/johnDoe/Processing/ProcessFile
  2. /Users/johnDoe/Processing/BinaryFiles/ProcessBinaryFiles

and folder where the referenced notebook is placed:

     /Users/johnDoe/Referenced/myReferencedNotebook

then to reference the notebook from ProcessFile notebook would be:

%run ../Referenced/myReferencedNotebook

and to reference the notebook from ProcessBinaryFiles notebook would be:

%run ../../Referenced/myReferencedNotebook

HTH

No comments: