cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to pass parameters to different notebooks in a workflow?

Smriti1
New Contributor

I have three notebooks: Notebook-1, Notebook-2, and Notebook-3, with a workflow dependency sequence of 1 -> 2 -> 3.

Notebook-1 dynamically receives parameters, such as entity-1 and entity-2.

Since these parameters change with each run, how can I pass them from Notebook-1 to Notebook-2 and then from Notebook-2 to Notebook-3 for each execution?

I attempted to call Notebook-2 from Notebook-1, but this only creates nesting and doesn't solve the issue.

1 REPLY 1

adbooth01
New Contributor II

As long as the parameter names are the same in all Notebooks, whatever value you trigger the workflow with will automatically be sent to all the notebooks. 

For example, if all three notebooks in the workflow have parameters entity-1 and entity-2, and you trigger the workflow externally (like via Airflow) with the dynamic parameter value for each, it should just be sent to all the notebooks accordingly. These become "job parameters" which are then passed down to all tasks.

https://docs.databricks.com/en/jobs/create-run-jobs.html#pass-parameters-to-a-databricks-job-task

Now, if you need Notebook 1 to set a parameter for Notebook 2, that is a different solution.

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