-
Notifications
You must be signed in to change notification settings - Fork 66
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
feat: add round timestamp macro #84
Conversation
Hi @jpmmcneill, thanks for this! (And sorry for only getting to this now.) |
@jpmmcneill looks like we have a test failure here: https://app.circleci.com/pipelines/github/calogica/dbt-date/21/workflows/19108182-7ac3-440f-8e7c-27be40fc8df6/jobs/16?invite=true#step-104-70 |
FYI, getting similar errors on BigQuery, but not SF (I assume that's where you tested this?). |
Oe more thing: even if I remove the quotes, the test fails on BigQuery b/c the integration test is comparing a where not(rounded_timestamp =
timestamp_trunc(
cast(
datetime_add(
cast( time_stamp as datetime),
interval 12 hour
)
as timestamp),
day
)
) Since the macro is called round_timestamp, I think it's correct to return a timestamp and not a date, so maybe we want to adjust the integration test? |
@jpmmcneill fyi, pushed a couple of commits that I think address my comments above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @clausherther! Appreciate the commits. I think that this is good to be merged now |
I'll do releases for dbt-date and dbt-expectations this weekend. |
Small macro which I find helpful.
It's quite similar to the typical sql
date_trunc
in that it returns a date, but it returns the closest date to a given timestamp.