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: 

Passing values between notebook tasks in Workflow Jobs

brickster
New Contributor II

I have created a Databricks workflow job with notebooks as individual tasks sequentially linked. I assign a value to a variable in one notebook task (ex: batchid = int(time.time()). Now, I want to pass this batchid variable to next notebook task.

What is the best option to pass this variable to the next notebook? Is using widgets the only option to pass?

3 REPLIES 3

UmaMahesh1
Honored Contributor III

Hi @Saravanan Ponnaiah​ 

Stumbled across this old question so answering just in case.

You can use dbutils.notebook.exit and exit the 1st notebook with that batchid variable. You can then collect this variable in you next linked notebook.

Hope this helps..

Cheers..

Anonymous
Not applicable

Hi @Saravanan Ponnaiah​ 

Hope everything is going great.

Does @Uma Maheswara Rao Desula​  response answer your question? If yes, would you be happy to mark it as best so that other members can find the solution more quickly?

We'd love to hear from you.

Thanks!

fijoy
Contributor

@brickster You would use dbutils.jobs.taskValues.set() and dbutils.jobs.taskValues.get().

See docs for more details: https://docs.databricks.com/workflows/jobs/share-task-context.html

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!