Files
M7XBeastandCursor 109e009210
Generate Documentation / generate-docs (push) Canceled after 0s
Run package tests for all dbs / test-postgres (push) Canceled after 0s
Run package tests for all dbs / test-other-dbs (bigquery) (push) Canceled after 0s
Run package tests for all dbs / test-other-dbs (redshift) (push) Canceled after 0s
Run package tests for all dbs / test-other-dbs (snowflake) (push) Canceled after 0s
Run package tests for all dbs / clean-up-schemas (bigquery) (push) Canceled after 0s
Run package tests for all dbs / clean-up-schemas (redshift) (push) Canceled after 0s
Run package tests for all dbs / clean-up-schemas (snowflake) (push) Canceled after 0s
Fix metric bucket anchoring and add global whole-table metrics
Metrics reported row_count 0/1 against tables that plainly had 10+ rows.

1. The metric bucket was [run_date - 1d, run_date) - it ENDED at midnight at
   the start of the run day. A model stamping `dbt_updated_at =
   CURRENT_DATETIME()` writes rows during the run, so every row fell outside
   the bucket that run had just computed. Incremental merges that re-stamp
   rows each run then pushed them into the wrong bucket or out of every
   bucket. The bucket now covers the run's calendar day:
   [midnight of run date, +1d). interval_length_sec stays 86400 and the
   daily series is unchanged.

2. There was no way to see a table as a whole. `metrics_base_insert` now also
   emits `global__<metric>` computed over the whole table (`where true`)
   alongside the windowed series, so metrics stay meaningful for models whose
   time_filter holds historical/backfilled timestamps that miss the current
   bucket. A model with no time filter already computed globally and is not
   duplicated. Disable with `f2dq:emit_global_metrics: false`.

3. overview.json metric rows dropped `time_window_start`, so no consumer could
   tell a bucket's width or spot an empty one. It is exported now.

Also: keep the guard that skips save_test_history when the f2dq_test_history
relation does not exist.

The integration_tests project pins the original re_data bucket anchoring and
`f2dq:emit_global_metrics: false` because its expected_*.csv seeds encode the
values that bucket produces and cannot be regenerated without the upstream
multi-database harness.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-14 22:15:58 +03:00

128 lines
3.3 KiB
YAML

name: "f2dq_integration_tests"
version: "1.0"
config-version: 2
# Changed when running tests
profile: "f2dq_postgres"
target-path: "target"
clean-targets: ["target", "dbt_modules", "dbt_packages"]
models:
f2dq:
enabled: true
sources:
f2dq_integration_tests:
+f2dq_monitored: true
+f2dq_time_filter: null
vars:
f2dq:store_table_samples: true
# The expected_*.csv seeds encode re_data's original bucket anchoring
# ([run_date - 1d, run_date)) and only the rows that bucket produces. The
# package default now anchors the bucket on the run date and also emits
# `global__*` metrics; both change the result set, and the seed values cannot
# be regenerated without the upstream multi-database harness. Pin the legacy
# behaviour here so this suite keeps exercising the metric engine and the
# `global__`-vs-windowed naming contract. The corrected behaviour is covered
# by the contract tests in the control_plane test suite.
f2dq:emit_global_metrics: false
f2dq:time_window_end: '{{ run_started_at.strftime("%Y-%m-%d 00:00:00") }}'
f2dq:time_window_start: '{{ (run_started_at - modules.datetime.timedelta(1)).strftime("%Y-%m-%d 00:00:00") }}'
f2dq:anomaly_detector:
name: modified_z_score
threshold: 0.6
f2dq:max_columns_in_query: 1
f2dq:select:
- tag:testtag
- sample_table
- sample_without_time_filter
- sample_with_anomaly
- f2dq_source_test_table
f2dq:metrics_groups:
integration_test_group:
table:
- row_count
- freshness
- my_distinct_table_rows
column:
numeric:
- min
- max
- avg
- stddev
- variance
- nulls_count
- nulls_percent
- diff # my own custom metric
text:
- min_length
- max_length
- avg_length
- nulls_count
- nulls_percent
- missing_percent
- missing_count
f2dq:default_metrics:
- integration_test_group
seeds:
+schema: seeds
+quote_columns: false
f2dq_integration_tests:
monitoring:
sample_with_anomaly:
+f2dq_monitored: true
+f2dq_time_filter: creation_time
sample_without_time_filter:
+f2dq_monitored: true
+f2dq_time_filter: null
sample_table:
+f2dq_monitored: true
+f2dq_time_filter: creation_time
+f2dq_columns:
- event_type
- value1
- value2
- null_value
+f2dq_metrics:
table:
- my_custom_table_metric # my own custom metric
- distinct_table_rows
column:
event_type:
- regex_test:
regex: ([A-Za-z0-9]+)
- match_regex:
regex: ^sell
- match_regex_percent:
regex: ^sell
- not_match_regex:
regex: ^buy
- not_match_regex_percent:
regex: ^buy
- distinct_values
- duplicate_values
- duplicate_rows
- unique_rows
expected_z_score:
+column_types:
time_window_end: "TIMESTAMP"
expected_metrics:
+column_types:
time_window_start: "TIMESTAMP"
time_window_end: "TIMESTAMP"