@can i define two elementary volume tests one with...
# ask-elementary-ai
s
@can i define two elementary volume tests one with timestamp column and other without
k
A message from kapa.ai
You cannot define two elementary volume anomaly tests (elementary.volume_anomalies) on the same model—one with a timestamp column and one without—using the standard dbt YAML configuration, because dbt and Elementary do not support specifying a test with and without a timestamp_column on the same model in a straightforward way. A common workaround is to define the timestamp_column only at the test level, not at the model config level. For example:
Copy code
yaml models:   - name: model_name     tests:       - elementary.volume_anomalies:  # total volume (no timestamp)           tags: ['elementary']       - elementary.volume_anomalies:  # volume by bucket (with timestamp)           tags: ['elementary']           timestamp_column: processed_at
This way, the first test runs without a timestamp (total table volume), and the second runs with the specified timestamp column (bucketed by time). However, if you set the timestamp_column at the model config level, it will apply to all tests unless you override it at the test level. Attempts to explicitly set
timestamp_column: null
to override a model-level config do not work as expected in dbt/Elementary as of now. If you need both tests, you should avoid setting the timestamp_column at the model config level and instead specify it only at the test level where needed. Alternatively, some users duplicate the model in the YAML to achieve this, but that's not ideal. This approach is confirmed by Elementary support staff and community discussions: you can define both tests at the test level, but not by mixing model-level and test-level timestamp_column settings, and not by setting timestamp_column: null to override a model-level config. See the detailed discussion here: [Slack thread on volume_anomalies with and without timestamp](https://slack.com/archives/C02CTC89LAX/p1684167121364969).