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

Confusing behavior of macro: dbt_expectations.expect_row_values_to_have_recent_data #212

Open
chasemeadows opened this issue Oct 27, 2022 · 2 comments

Comments

@chasemeadows
Copy link

these 2 tests:

https://github.com/calogica/dbt-expectations/blob/main/macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql

https://github.com/calogica/dbt-expectations/blob/main/macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql

have unexpected behavior when testing against fields that are date only. For example, in many use cases, these tests may check against a field such as batch_date which would be a date-only field that indicates the batch of data that the batch load corresponds to. This test will compare that date to a timestamp. So for example, if you had a test that runs on t-1 lookback that is orchestrated at 10-27 21:00 UTC, you would be comparing 10-26 21:00 UTC vs 10-26 00:00 UTC, and the test would always fail.

My suggestion is to have some type of behavior that checks if the column_name provided is a date field vs a timestamp and perform the check accordingly.

@clausherther
Copy link
Contributor

Hi @chasemeadows, thanks for opening this issue. Could you please add which platform (Postgres, BigQuery, Snowflake) you're on and which version of dbt-expectations you're using? Thanks!

@rud0812
Copy link

rud0812 commented May 25, 2023

Also experiencing this issue with Snowflake

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

No branches or pull requests

3 participants