Hi team, is there a way to get the last run and st...
# community-support
n
Hi team, is there a way to get the last run and status for a specific job id by querying the elementary tables ? i.e. we'd like to know if the last run for a given job was successful or not thank you !
✅ 1
👀 1
i
Hi @Nic! Are you currently passing
JOB_ID
as an environment variable to your dbt runs?
n
Hi @Itamar Hartstein yes ! I can see the job_id in
job_run_results
but I'm not sure how to determine that its last run has been successful For reference, the job is scheduled on dbt cloud
Is there a way to do so by querying
dbt_invocations
+ another table ? ideally, the output would be:
job_id | last_run_id | last_run_successful
i
Yeah - you can join
dbt_run_results
with
dbt_invocations
by
invocation_id
in
dbt_run_results
you have a
status
field which can be
pass
,
fail
or
error
n
Thank you @Itamar Hartstein!