<@U088WCP3B4P> How can I go about replacing this t...
# ask-elementary-ai
c
@kapa.ai How can I go about replacing this test in my project?
Copy code
{% test volume_anomalies(model, timestamp_column, where_expression, anomaly_sensitivity, anomaly_direction, min_training_set_size, time_bucket, days_back, backfill_days, seasonality, sensitivity, ignore_small_changes, fail_on_zero, detection_delay, anomaly_exclude_metrics, detection_period, training_period) %}
  {{ config(tags = ['elementary-tests']) }}

  {{ elementary.test_table_anomalies(
      model=model,
      table_anomalies=["row_count"],
      freshness_column=none,
      timestamp_column=timestamp_column,
      where_expression=where_expression,
      anomaly_sensitivity=anomaly_sensitivity,
      anomaly_direction=anomaly_direction,
      min_training_set_size=min_training_set_size,
      time_bucket=time_bucket,
      days_back=days_back,
      backfill_days=backfill_days,
      seasonality=seasonality,
      sensitivity=sensitivity,
      ignore_small_changes=ignore_small_changes,
      fail_on_zero=fail_on_zero,
      detection_delay=detection_delay,
      anomaly_exclude_metrics=anomaly_exclude_metrics,
      detection_period=detection_period,
      training_period=training_period
    )
  }}
{% endtest %}
k
A message from kapa.ai
To replace your custom
volume_anomalies
test that wraps
elementary.test_table_anomalies
with the modern, recommended approach, you should use the built-in
elementary.volume_anomalies
test in your
schema.yml
or model configuration. The
elementary.volume_anomalies
test is now the preferred and documented way to monitor row count anomalies, and it supports all the relevant configuration parameters directly. Here’s how you can translate your custom test to the new format:
Copy code
yaml models:   - name: <model_name>     tests:       - elementary.volume_anomalies:           timestamp_column: <timestamp_column>           where_expression: <where_expression>           anomaly_sensitivity: <anomaly_sensitivity>           anomaly_direction: <anomaly_direction>           min_training_set_size: <min_training_set_size>           time_bucket:             period: <period>             count: <count>           days_back: <days_back>           backfill_days: <backfill_days>           seasonality: <seasonality>           sensitivity: <sensitivity>           ignore_small_changes:             spike_failure_percent_threshold: <value>             drop_failure_percent_threshold: <value>           fail_on_zero: <fail_on_zero>           detection_delay:             period: <period>             count: <count>           anomaly_exclude_metrics: <anomaly_exclude_metrics>           detection_period:             period: <period>             count: <count>           training_period:             period: <period>             count: <count>           tags: ['elementary-tests']
Key points: - All the parameters you used in your custom test are supported as arguments to
elementary.volume_anomalies
. - You no longer need to use a custom Jinja test or call
elementary.test_table_anomalies
directly. - The
elementary.volume_anomalies
test is the direct replacement for the
table_anomalies
test with
row_count
and is the recommended approach going forward. Backward compatibility for the old approach exists, but it is no longer documented or recommended for new projects [Test configuration](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/volume-anomalies#test-configuration) [Slack clarification](https://slack.com/archives/C02CTC89LAX/p1692128245054759). If you have any parameters that are not directly supported, consult the [anomaly detection configuration documentation](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/anomaly-params) for the full list of supported options. Summary: Replace your custom test with a YAML-based
elementary.volume_anomalies
test in your model or schema file, mapping your parameters accordingly. This is the modern, supported, and documented approach.