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:ย 

Pass parameters between jobs

dpc
Contributor

Hello

 

I have job

In that job, it runs a task (GetGid) that executes a notebook and obtains some value using dbutils.jobs.taskValuesSet

e.g. dbutils.jobs.taskValuesSet(key = "gid", value = gid)

As a result, I can use this and pass it to another task for use by setting the parameter

e.g. Key - gid; Value - {{tasks.GetGid.values.gid}}

This works find and it see gid and uses it (the task runs a sql notebook with a widget

 

How do I pass and use this to a job task?

gid should be passed such that it can be used in tasks there

e.g. a futher notebook task or maybe an if/then task

All within the downstream job

 

I can do this easily in Azure Data Factory but cannot find a solution in databricks

 

Any ideas?

Is this even possible? It feels fairly basic

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hubert-Dudek
Esteemed Contributor III

Python:
dbutils.jobs.taskValuesSet()

SQL:

Results from sql query are visible in the workflow and you can use them to orchestrate another task (first row or loop)

View solution in original post

5 REPLIES 5

ilir_nuredini
Honored Contributor

Hi @dpc ,

I am having a bit difficulty to understand complete what is your need. May you check this link: https://docs.databricks.com/aws/en/jobs/task-values  and see if that resolves your need. Let me know how it goes.

Best, Ilir

Thanks.

That works fine but what I really want to be able to do is pass parameters between jobs.

So, create a job task within a job and pass all the parameters down to that job so they can be used

Hubert-Dudek
Esteemed Contributor III

Python:
dbutils.jobs.taskValuesSet()

SQL:

Results from sql query are visible in the workflow and you can use them to orchestrate another task (first row or loop)

What about SQL variables? Can I retrieve in a latter task a variable set in a previous one?

 

dpc
Contributor

Thanks @Hubert-Dudek and @ilir_nuredini 

I see this now

I'm setting using:dbutils.jobs.taskValues.Set()

passing to the job task using Key - gid; Value - {{tasks.GetGid.values.gid}}

Then reading using: pid = dbutils.widgets.get()

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now