For users of dbt version 1.8 and above

Add the following flag to your dbt_project.yml file:

dbt_project.yml
flags:
  source_freshness_run_project_hooks: True

This flag enables Elementary to automatically collect source-freshness results, just like any other test results.

For dbt version under 1.8

In dbt versions lower than 1.8, the results of the command dbt source-freshness are not automatically collected. You can collect the results using the Elementary CLI tool.

If dbt source freshness results are collected, they will be presented in the UI, and in alerts upon failure.

dbt core users

To alert on source freshness, you will need to run the following command:

edr run-operation upload-source-freshness --project-dir <path to your project>

The command needs to be executed after you run dbt source freshness and before executing edr monitor.

This operation will upload the results to a table, and the execution of edr monitor will send the actual alert.

  • Note that dbt source freshness and upload-source-freshness needs to run from the same machine.
  • Note that upload-source-freshness requires passing --project-dir argument.

dbt Cloud users

The results can't be collected from dbt Cloud. Here is a suggestion from an Elementary user for a solution you can implement.