Hello,
I’d like to map the steps of my dbt jobs with their usage in BigQuery.
To do this, I’m calling the dbt API using Airbyte.
I’m currently using the following endpoint:
https://cloud.getdbt.com/api/v2/accounts/{account_id}/runs/
However, I’d like to add a time filter (last day or last 12 hours) so I can retrieve only the most recent job runs.
Does anyone know if this is possible, and if so, could you share the query or parameters needed to achieve that?
Thanks in advance!
Hello! We’ve used this functionality in my work!
For instance, if we want the most recent successful run our endpoint would look like so:
https://cloud.getdbt.com/api/v2/accounts/{account_id}/runs/?order_by=-finished_at&project_id={project_id}&environment_id={environment_id}&status=10&limit=5
(Note the -finished_at to order descending and limit=5 for limiting how many results you get.)
We’ve used the API v2 job page to play around with filtering. If you add to the parameters at the right, it’ll update the URL for the endpoint in various ways in the box below that.
You can even add to that URL to filter to a specific job, too, if you have a primary job that you are always wanting to reference.