calogica / dbt-expectations

Port(ish) of Great Expectations to dbt test macros
https://calogica.github.io/dbt-expectations/
Apache License 2.0
1.04k stars 126 forks source link

Syntax error with take_diff=False in expect_column_values_to_be_within_n_moving_stdevs test #177

Closed karanhegde closed 2 years ago

karanhegde commented 2 years ago

Hi, when the expect_column_values_to_be_within_n_moving_stdevs test is used with the parameter take_diff=False, it errors out with a couple of SQL syntax issues, a trailing comma (atleast with BigQuery) and a missing alias.

Sample config:

- dbt_expectations.expect_column_values_to_be_within_n_moving_stdevs:
    sigma_threshold: 2
    date_column_name: "day"
    take_diffs: False
    trend_periods: 365

The fix is straightforward, happy to submit a PR for this if that works!

clausherther commented 2 years ago

Oy! Who wrote this nonsense!? Wait, that was me!

Thanks for finding this, and yes a PR would be great if you have the time. If not, I can find time this week to fix this.