-
Notifications
You must be signed in to change notification settings - Fork 1
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
change started_at ended_at to be timestamps #53
Conversation
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.
didn't realize these weren't timestamps already- good catch!
with | ||
school_years as ( | ||
select * | ||
select | ||
school_year::varchar, |
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.
school_year::varchar, | |
school_year::varchar(7), |
school_year_int::integer, | ||
started_at::timestamp, | ||
ended_at::timestamp, | ||
school_year_long::varchar |
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.
school_year_long::varchar | |
school_year_long::varchar(9) |
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-- my only thought is to maintain precision here for school_year
and school_year_long
and to make sure we test the timestamp changes resolves what was called out above and doesn't adversely affect anything upstream in dbt
|
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.
let's huddle about this date/timestamps thiing but this is fine.
Description
This PR casts the
started_at
andended_at
fields in int_school_years to be timestamps.Directly from the seed file the were loaded as type varchar. This causes our use of these fields using date logic to incorrectly evaluate expressions using between because it's evaluating the dates as strings. What's moderately crazy is that this only effects exact date matches. For example:
Returns null. But...(change the date July 2)....
returns the expected row.
This can all be solved/fixed by casting started_at and ended_at as dates/timestamps.
The original analysis.school_years used timestamps so we will here as well.