The problem I’m having:
I would like to use the dbt Cloud API to get job run details. Specifically which models failed. What is the API endpoint to query? I can use http://cloud.getdbt.com/api/v2/accounts/account/runs/jobrunid and get data.status_humanized to see “Error” but I want to see which models had the failure(s). I can query https://cloud.getdbt.com/api/v2/accounts/account/runs/jobrunid/?include_related=[“run_steps”] and see which command had errors but is there a way to succinctly get just the models that had a failure?
The context of why I’m trying to do this
I am hitting the dbt Cloud endpoints using a Web activity from ADF and wanting to save the output to a variable and then based on that display the error and fail the activity or move forward with the next step in our ELT process.
Thanks for any help!
You could download (using the API) the run_results.json artifact that is generated after each run.
The discovery API I think can tell you the status of models for the run.
Note: @Jeremy Yeo
originally posted this reply in Slack . It might not have transferred perfectly.
@a_slack_user Thanks for your help. I am somewhat new to API calls. When I try a GET with https://cloud.getdbt.com/api/v2/accounts/1/runs/1/artifacts/run_results.json using my account and my run id, I get a 404 Not Found error in Postman. Should I be calling it in a different way or is this only returned if we are above dbt v 1.0 for now? Thank you!
@a_slack_user I was able to get run_results.json artifact. Seems like I’ll need to search for where “failures” is not equal to null. Thanks for the starting point!
system
Closed
July 2, 2024, 4:29am
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.