azuredatabricksazure-databricksazure-synapse

Referencing another notebook in Synapse from different Folder


I am trying to reference notebook in another notebook using mssparkutils.notebook.run and it would initially work, however when I introduced more folders and subfolders it stopped

What I've done in the past was

env = 'test'

mssparkutils.notebook.run(path="Load Data from SAP", arguments={"environment": f"{env}" }) 

The error is 404, claims this notebook is not existing. It does, however in folder MasterData and subfolder SKU

I tried different approaches like

env = 'test'

mssparkutils.notebook.run(path="/MasterData/SKU/Load Data from SAP", arguments={"environment": f"{env}" }) 

or

env = 'test'

mssparkutils.notebook.run(path="Notebooks/MasterData/SKU/Load Data from SAP", arguments={"environment": f"{env}" })

Nothing seem to work. How to reference that properly? My notebooks are published ** Tagging also databricks because its similar there but dbutils not msspark **


Solution

  • If the Notebooks level is like

    Notebook1
    folder1
        mynotebook
        subfolder1
            mynotebook2
    

    then, you need to give the path like below from Notebook 1 to achieve your requirement.

    env = 'test'
    
    mssparkutils.notebook.run(path="/folder1/subfolder1/mynotebook2", arguments={"environment": f"{env}" })
    

    enter image description here

    To overcome the error, make sure you publish all the notebooks and also try troubleshooting steps like checking connection and clearing the browser cache.