Morning. I'm trying to set up a volume anomoly va...
# community-support
e
Morning. I'm trying to set up a volume anomoly validation - however when I run the test on the cli it raises that there are 2 errors but I can only see 1 in the data. I'm looking at ELEMENTARY.METRICS_ANOMALY_SCORE. Is there a different table or somewhere else I should be checking. Thx. Em
- elementary.volume_anomalies:
timestamp_column: <timestamp column>
detection_period:
period: day
count: 5
training_period:
period: day
count: 30
time_bucket: # Daily by default
period: day
count: 1
anomaly_sensitivity: 1
#C02CTC89LAX any thoughts please
d
Hey @Emma Emerton, Can you share the output of
dbt test
?
e
@Daniel Pollak Apologies for the delay. Priorities changed I've had to move the data a little and so now am trying this test:
Copy code
tests:
          - elementary.volume_anomalies:
              timestamp_column: event_ts
              detection_period:
                period: day
                count: 4
              training_period:
                period: day
                count: 30
              time_bucket: # Daily by default
                period: day
                count: 1
              seasonality: day_of_week
              # anomaly_direction: drop
              anomaly_sensitivity: 1
The output from dbt is:
Copy code
10:04:25 Found 1502 models, 10458 tests, 18 seeds, 3 operations, 233 sources, 13 exposures, 0 metrics, 1581 macros, 0 groups, 0 semantic models
10:04:26  
10:04:50  
10:04:50 Running 1 on-run-start hook
10:04:51 1 of 1 START hook: elementary.on-run-start.0 ................................... [RUN]
10:04:51 1 of 1 OK hook: elementary.on-run-start.0 ...................................... [OK in 0.00s]
10:04:51  
10:04:51 Concurrency: 1 threads (target='dev')
10:04:51  
10:04:51 1 of 1 START test elementary_source_volume_anomalies_schema_table_1__day__4__day_of_week__day__1__event_ts__day__30 [RUN]
10:04:53 Elementary: Started running data monitors on: <source.schema.table>
10:04:58 Elementary: Finished running data monitors on: <source.schema.table>
10:05:00 1 of 1 FAIL 4 elementary_source_volume_anomalies_schema_table_1__day__4__day_of_week__day__1__event_ts__day__30 [FAIL 4 in 9.04s]
10:05:01  
10:05:01 Running 2 on-run-end hooks
10:05:01 apply_meta_as_tags
10:05:01 1 of 2 START hook: dwh.on-run-end.0 ............................................ [RUN]
10:05:01 1 of 2 OK hook: dwh.on-run-end.0 ............................................... [OK in 0.00s]
10:15:41 2 of 2 START hook: elementary.on-run-end.0 ..................................... [RUN]
10:15:41 2 of 2 OK hook: elementary.on-run-end.0 ........................................ [OK in 0.00s]
10:15:41  
10:15:42  
10:15:42 Finished running 1 test, 3 hooks in 0 hours 11 minutes and 16.08 seconds (676.08s).
10:15:43  
10:15:43 Completed with 1 error and 0 warnings:
10:15:43  
10:15:43 Failure in test elementary_source_volume_anomalies_schema_table_1__day__4__day_of_week__day__1__event_ts__day__30 (models/sources/table.yml)
10:15:43  Got 4 results, configured to fail if != 0
10:15:43  
10:15:43  compiled Code at target/compiled/dwh/models/sources/table.yml/elementary_source_volume_anoma_3120f634d9cd0827f0a8b950bef28316.sql
10:15:43  
10:15:43 Done. PASS=0 WARN=0 ERROR=1 SKIP=0 TOTAL=1
The output from the target is:
Copy code
-- depends_on: dwh_preprod_DSE5940.elementary.monitors_runs
  -- depends_on: dwh_preprod_DSE5940.elementary.data_monitoring_metrics
  -- depends_on: dwh_preprod_DSE5940.elementary.dbt_run_results

  
    -- depends_on: dwh_preprod_DSE5940.elementary.monitors_runs
    -- depends_on: dwh_preprod_DSE5940.elementary.data_monitoring_metrics
    -- depends_on: dwh_preprod_DSE5940.elementary.dbt_run_results
I really don't know what I've got 4 errors? Help
I've figured it out (!) I have one anomoly breach but there are 4 rows - so it is saying that all 4 rows have failed when actually only 1 has
d
Hey @Emma Emerton, could you debug this code? I can’t run it
e
I 'debugged' it by trying out different scenarios and examining the resulting behaviour.
d
I see , but could you execute the compiled code created?
e
yeah - I had the actual column name instead of <timestamp column> though
d
Ah, thanks a lot. I can’t run mine. It’s not recognising the temporary tables. @Elon Gliksberg, do you mind helping here? Or get someone in the team who can help, please? I’m trying to run a debugged code provided by elementary, and it doesn’t work, it says:
elementary.test_dcadf2222a_elementary_volume_anomalies_eng_prs_calendar_hour__12__anomaly_scores__tmp_20240424105420546231 was not found in location EU
Happy to send a separate message, if this is jeopardising yours @Emma Emerton
e
@David Boudart no carry on - I found the error message from it so unhelpful as to be pointless and trying to trace through the views and tables was a nightmare. I came to the conclusion the views didn't reflect entirely what I had configured (for instance I had an anomoly threshold of 2 but that wasn't reflected) so were of limited use. I was running at the command line if that's any help