> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elementary-data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Collect dbt source freshness results

<Note>For users of dbt version 1.8 and above</Note>

Add the following flag to your `dbt_project.yml` file:

```yaml dbt_project.yml theme={null}
flags:
  source_freshness_run_project_hooks: True
```

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

<Note>For dbt version under 1.8</Note>

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:

```shell theme={null}
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](https://elementary-community.slack.com/archives/C02CTC89LAX/p1688113609829869) for a solution you can implement.

## Need help?

Reach out to the Elementary team to consult on implementing dbt source freshness collection as an Elementary Cloud user.
