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 can I pass job parameters to a dbt task?

jabori
New Contributor

I have a dbt task that will use dynamic parameters from the job: {"start_time": "{{job.start_time.[timestamp_ms]}}"}

My SQL is edited like this:
select 1 as id
union all
select null as id
union all
select {start_time} as id

This causes the task to fail. How can I pass the start_time parameter correctly?

2 REPLIES 2

MathieuDB
Databricks Employee
Databricks Employee

Hello @jabori,

Can you try using the var() function to see if it fix the issue?

select 1 as id
union all
select null as id
union all
select {{ var('start_time') }} as id

MathieuDB
Databricks Employee
Databricks Employee

Also, you need to pass the parameters using the --vars flag like that:

dbt run --vars '{"start_time": "{{job.start_time.[timestamp_ms]}}"}'

You will need to modify the 3rd dbt command in your job.

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