Ninad Thorat
10/01/2025, 10:07 AMkapa.ai
10/01/2025, 10:07 AMkapa.ai
10/01/2025, 10:07 AMtimestamp_column (typical for truncate-and-load tables) - The test tracks the total row count each time it runs, not per time bucket. - The training period is built up over multiple test runs (e.g., 14 runs for a 14-day training period). - Configure the test like this: yaml tests: - elementary.volume_anomalies: training_period: 14 # Number of test runs to use as training set detection_period: 2 # Number of most recent runs to check for anomalies - Note: You must run the test enough times to build up the training set. For a 14-day training period, you need 14 runs on different days before anomaly detection is possible. Each run adds a new data point to the training set. The detection period defines how many recent runs are checked for anomalies. [Anomaly Tests Troubleshooting Guide](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/Anomaly-troubleshooting-guide) ### 2. With a timestamp_column - If you can use a timestamp column (e.g., a load date), Elementary will group data into time buckets (e.g., daily). - Configure the test like this: yaml tests: - elementary.volume_anomalies: timestamp_column: <your_timestamp_column> training_period: period: day count: 14 detection_period: period: day count: 2 time_bucket: period: day count: 1 - Here, the training period uses the last 14 days (or whatever period you set), and the detection period checks the last 2 days for anomalies. [training_period docs](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/training-period) | [detection_period docs](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/detection-period) ### Key Points - For truncate-and-load tables, if you do not have a timestamp column, the training and detection periods are based on the number of test runs, not calendar days. - If you do have a timestamp column, periods are based on the data in those time buckets. - You must run the test enough times to build up the training set if not using a timestamp column. If you need to monitor the entire table's row count after each load, do not set a timestamp column. If you want to monitor by date or another time dimension, set the timestamp_column accordingly. For more details, see the official documentation on [volume_anomalies test configuration](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/volume-anomalies#test-configuration) and [training_period](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/training-period).Ninad Thorat
10/01/2025, 10:19 AMNinad Thorat
10/01/2025, 10:19 AMkapa.ai
10/01/2025, 10:19 AMkapa.ai
10/01/2025, 10:20 AMtimestamp_column, the detection period in Elementary's volume anomaly test is set using the backfill_days parameter. This parameter defines how many recent test runs (not calendar days) are included in the detection period for anomaly detection. You can configure it in your test YAML like this: yaml tests: - elementary.volume_anomalies: backfill_days: 2 # Number of most recent runs to include in the detection period - For tables without a timestamp column, backfill_days is used only as the detection period. Each test run adds a new data point, and the detection period will include the specified number of most recent runs. - There is no time bucketing; the detection period is simply the last N runs, as defined by backfill_days [Slack discussion](https://slack.com/archives/C02CTC89LAX/p1688112798629339). Note: The detection_period parameter is only relevant for tests with a timestamp_column. For truncate-and-load tables without a timestamp column, use backfill_days to control the detection period [Detection period docs](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/detection-period). If you need to skip anomaly detection for a while (e.g., after a structural change), you can increase backfill_days or temporarily disable the test [Slack discussion](https://slack.com/archives/C02CTC89LAX/p1683560936330689).