The results.json captures the query id for successful model runs for snowflake materializations. However we don’t get the query id for failures. Is it possible to get the query id for failures ; if so how can we proceed ?
1 Like
Surya
May 20, 2023, 12:49pm
2
For failures u will not see query id in run results.json because dbt adds query id to the run_results.json only for successfully executions.
dbt logs query id in dbt.log file for failed executions.
U have to check the dbt.log file for queryid
Could link to some reference/documentation for the same?
Surya
May 22, 2023, 4:29am
4
@u.bhatt
here is the GitHub issues which talked abt it
opened 11:10PM - 31 May 22 UTC
closed 01:57AM - 29 Dec 22 UTC
enhancement
Stale
### Is this your first time opening an issue?
- [X] I have read the [expectatio… ns for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
### Describe the Feature
I have been hunting down some performance issues recently and was having a hard time finding the query related to my model.
It would be extremely useful to display the query_id in the printed logs:
![image](https://user-images.githubusercontent.com/18498445/171298126-957fa20b-ac1e-46a8-a5b2-95ca598d0604.png)
### Describe alternatives you've considered
I am using Snowflake and look for queries fired by DBT using the search history (or query history tables)
### Who will this benefit?
Any dbt user who would like to get more insights into the query fired by dbt.
It depends on the database but will usually give useful information such as the explain plan.
This helps anyone who needs to investigate what's happening in the database.
### Are you interested in contributing this feature?
I'd need help on where to start but happy to help!
### Anything else?
https://getdbt.slack.com/archives/C2JRTGLLS/p1653515842370159