David McCandless
09/29/2025, 5:25 PMtimestamp_column and ensures the row count for the max(timestamp_column) value > row count for the prior timestamp_column value.
my row count should always be growing and I want to know if it starts to dropkapa.ai
09/29/2025, 5:25 PMkapa.ai
09/29/2025, 5:25 PMelementary.volume_anomalies test—to monitor for drops in row count over time. This test splits your data into time buckets (e.g., daily) based on a timestamp_column and alerts if the row count in the latest bucket drops compared to historical values. Here’s how you would configure such a test in your model’s YAML file: yaml models: - name: <your_model_name> tests: - elementary.volume_anomalies: timestamp_column: <your_timestamp_column> # Optionally, you can configure time_bucket, detection_period, etc. This test will monitor the row count per time bucket (e.g., per day) and alert if there is a significant drop in the most recent bucket compared to previous periods. While it does not explicitly compare only the last two values, it is designed to catch drops in row count, which aligns with your goal of being alerted if the row count stops growing or decreases for the latest period. If you want to monitor the total row count (e.g., for tables that are fully refreshed), you can omit the timestamp_column, and the test will compare the total row count snapshot over time instead. This is useful for detecting any decrease in the total number of rows between runs, as described in the knowledge sources [volume anomalies test documentation](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/volume-anomalies) and Slack discussions [here](https://slack.com/archives/C02CTC89LAX/p1650989426047689). If you require a test that strictly compares only the last two values of the timestamp column, the knowledge sources do not provide an out-of-the-box solution or a custom SQL example for this exact logic. You may need to implement a custom dbt test for this specific requirement. Summary: - Use elementary.volume_anomalies with timestamp_column to monitor for drops in row count per time bucket. - There is no built-in test to compare only the last two timestamp values, but the anomaly detection test will alert on drops in the latest period, which serves a similar purpose. For more details, see the [volume anomalies documentation](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/volume-anomalies).