Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add group_by option to expect_column_values_to_be_within_n_moving_stdevs #182

Merged
merged 2 commits into from
Sep 14, 2022

Conversation

clausherther
Copy link
Contributor

Closes #166
This PR adds an option to specify a grouping level for the expect_column_values_to_be_within_n_moving_stdevs test. This allows uses to check for anomalies over time within groups, such as products or customers.

if group_by is specified, the macro groups the initial metric aggregation and then adds partition_by statements to the relevant window functions.

E.g.

  - name : my_model
    columns:
      - name: row_value
        tests:
          - dbt_expectations.expect_column_values_to_be_within_n_moving_stdevs:
              date_column_name: date_day
              group_by: [group_id]
              sigma_threshold: 3
              take_logs: true
              severity: warn

@clausherther
Copy link
Contributor Author

@jordanjbanal lmk if this is what you had in mind with #166!

@clausherther clausherther merged commit 15f6908 into main Sep 14, 2022
@clausherther clausherther deleted the feature/issue-166 branch September 14, 2022 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a way to integrate dimension to: expect_column_values_to_be_within_n_moving_stdevs
1 participant