In short:
Is there a way to, after tests have ran, print the compiled test sql queries for the failing tests?
We have many tests for datatypes, unique-combination-of-columns and not-nulls for example.
To know which tests failed we now check either
- a databricks dashboard thats based on dbt-artifacts tables
- the stdout of the databricks workflow we use
The compiled test query does not seem to be included in dbt-artifacts tables (correct me if I am wrong!?) (although we have the variable dbt_artifacts_exclude_all_results: true
, but it would be kind of overkill to include it just for this I guess)
And the path to the compiled test query is printed, but the query itself is not. The query is the exact thing that is necessary to start your debugging.
Is there a way to print that compiled query?
Things I considered:
- running a python on-run-end hook… just failed, I dont know how other people succeed, but I could not find a way to run a python script from the dbt hooks… And IF that works, would there be sufficient context available to determine a failed test and get it’s compiled query?
- Considering “store_failures”, yes, is probably a nice alternative, although having the actual test query is more helpful I believe, since that is the query you need for debugging.
Many thanks in advance!