<@U088WCP3B4P>, is it possible to see if the entir...
# ask-elementary-ai
e
@kapa.ai, is it possible to see if the entire invocation was completed using the existing models/tables?
k
A message from kapa.ai
Yes, it is possible to determine if an entire invocation was completed using the existing Elementary models/tables. The dbt_invocations table records each dbt invocation (such as dbt run, dbt test, dbt build, etc.) and includes metadata like start and completion times, status, and other attributes. This table is populated at the end of each invocation via the on-run-end hook, ensuring that only completed invocations are recorded. You can use the run_completed_at field to check if an invocation has finished, and the status field (in dbt_run_results) to assess the outcome of the resources executed during that invocation. By joining dbt_invocations with dbt_run_results on invocation_id, you can get a comprehensive view of the invocation's completion and the status of its components [Elementary dbt package models](https://docs.elementary-data.com/dbt/package-models#run-results). However, note that dbt_invocations is only updated at the end of a run, so it does not reflect in-progress invocations—only those that have completed [Slack discussion on invocation timing](https://slack.com/archives/C02CTC89LAX/p1739440054540759).
e
@kapa.ai, but dbt_run_results are on the table level. One invocation could have several commands. One command could update several tables. So, I will be able to see the status f the individual tables in each command but not the status of the invocation or command overall. Is it right?
k
A message from kapa.ai
You are correct: the dbt_run_results table records results at the resource level (e.g., each model, test, or snapshot), not at the overall invocation or command level. Each row in dbt_run_results represents the result of a single resource within a specific invocation, including its status and execution times. This means you can see the status of individual tables or tests for each command, but not a direct "overall status" for the entire invocation or command in this table alone. However, the dbt_invocations table provides metadata for each invocation (i.e., each dbt run, test, or build command), including start and end times and other attributes. While dbt_invocations gives you information about the invocation as a whole, it does not directly summarize the overall success or failure of all resources within that invocation. To get a sense of the overall status, you would typically join dbt_invocations with dbt_run_results on invocation_id and then aggregate or analyze the statuses of the individual resources to infer the overall outcome of the invocation or command. There is no single "overall status" field for the entire invocation or command in the existing models, so some post-processing is required if you want to derive that summary status yourself [Elementary dbt package models](https://docs.elementary-data.com/dbt/package-models#run-results). If you need a job-level summary (e.g., for dbt Cloud jobs), you can use the job_run_results view, which is built on dbt_invocations, but again, it does not provide a direct overall status—aggregation is still needed [Elementary dbt package models](https://docs.elementary-data.com/dbt/package-models#run-results).
e
@kapa.ai, I see that all but dbt test appear in invocations with dbt core. what could be the reason?
Copy code
- ${"dbt debug --target " + dbt_target}
              - ${"dbt deps"}
              - ${"dbt seed --target " + dbt_target}
              - ${"dbt run --target " + dbt_target}
              - ${"dbt test --target " + dbt_target}
k
A message from kapa.ai
Based on the knowledge sources, the most likely reason why dbt test invocations do not appear in the dbt_invocations table (while other commands like dbt run, dbt seed, etc. do) is related to how dbt's on-run-end hooks are triggered. Elementary relies on dbt's on-run-end hook to upload invocation data to dbt_invocations. If, for some reason, the on-run-end hook is not triggered for dbt test, then the invocation will not be recorded. However, according to the documentation and Slack discussions, dbt_invocations should be populated for dbt run, dbt test, dbt build, dbt snapshot, and dbt seed commands, as long as there is at least one model or test executed during the invocation. If dbt test is not appearing, possible reasons could include: - No tests were actually executed (e.g., if there were no models or tests selected or nothing to test, the hook may not run). - There may be a configuration or version issue affecting the hook execution for dbt test. - If the dbt test command completes without running any tests (for example, if all models are up-to-date or filtered out), then dbt_invocations will not be populated for that run, as confirmed in Slack: "DBT_INVOCATIONS is populated only when there was actually some model run/test. otherwise even DBT_INVOCATIONS does not get a record either" [Slack discussion](https://slack.com/archives/C02CTC89LAX/p1672228916705469). If you are consistently seeing dbt test missing from dbt_invocations, check that your dbt test command is actually running tests and that there are no errors or skips. Also, ensure you are using compatible versions of dbt and Elementary, as version mismatches can sometimes affect hook execution. In summary: dbt_invocations will only record an entry for dbt test if at least one test is executed during the run. If no tests are run, no entry will be created for that invocation. This is expected behavior according to the knowledge sources.
e
@kapa.ai, dbt test still dont run with dbt core
k
A message from kapa.ai
Based on the knowledge sources, dbt test should be supported and tracked by Elementary when using dbt Core, as long as the tests are actually executed and the on-run-end hook is triggered. The dbt_invocations table is expected to be populated for dbt test, dbt run, dbt build, dbt seed, and dbt snapshot commands, provided that something is actually run or tested during the invocation. If no tests are executed (for example, if there are no applicable tests or all are filtered out), then dbt_invocations will not record an entry for that run—this is expected behavior and not a bug [Slack discussion](https://slack.com/archives/C02CTC89LAX/p1672228916705469). If you are running dbt test with dbt Core and still do not see entries in dbt_invocations, please check the following: - Ensure that tests are actually being executed (not skipped or filtered out). - Confirm that the Elementary dbt package is installed and not disabled. - Make sure there are no configuration issues or version mismatches that could prevent the on-run-end hook from running. If all of these are correct and dbt test invocations are still not being tracked, the knowledge sources do not provide further troubleshooting steps or indicate a known issue beyond what is described above.
e
@kapa.ai, it is still the same, the tests command run - they appear in the orchestrator log but then, they don appear in invocations (command)
k
A message from kapa.ai
Based on the knowledge sources, if your dbt test command is running (as seen in your orchestrator logs) but the invocation is not appearing in the dbt_invocations table, the most likely reasons are: 1. No Tests Actually Executed: If dbt test runs but does not actually execute any tests (for example, if all tests are filtered out, or there are no applicable tests for the selected models), then the on-run-end hook will not record an invocation in dbt_invocations. This is confirmed in the Slack discussion: > "as long as there is a dbt run or a test being executed, Elementary will capture it... If there was no fresher data in any of the sources... data will not be uploaded to dbt_invocations." [Slack discussion](https://slack.com/archives/C02CTC89LAX/p1672228916705469) 2. On-run-end Hook Not Triggered: If there is a configuration or environment issue that prevents the on-run-end hook from running (for example, if hooks are disabled or there is a version mismatch), then the invocation will not be recorded. > "Elementary relies on dbt's on-run-end hook to upload invocation data to dbt_invocations." [Slack discussion](https://slack.com/archives/C02CTC89LAX/p1712531617797139) 3. Profile/Target Mismatch: If dbt test is run on a different target or profile than the one Elementary is configured to monitor, the results may be written to a different schema or database, and thus not appear where you expect them. > "elementary and dbt test were not running on the same target." [Slack forum](https://slack.com/archives/C02CTC89LAX/p1684095583307509) If you have confirmed that tests are actually being executed and the correct profile/target is used, but invocations still do not appear, the knowledge sources do not provide further troubleshooting steps or indicate a known bug for this scenario. In such cases, it is recommended to check your dbt and Elementary versions for compatibility and review your dbt logs for any errors related to hooks or schema writes. If the issue persists, reaching out to the Elementary team with your dbt logs and configuration may be necessary, as suggested in the troubleshooting guide.