-
Notifications
You must be signed in to change notification settings - Fork 21
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
Bug/date not recognized #54
Conversation
cast(extract(year from current_date) as {{ dbt.type_string() }}) as current_year, | ||
cast(extract(year from {{ dbt.dateadd('year', -1, 'current_date') }}) as {{ dbt.type_string() }}) as last_year |
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.
I moved this up here just to make it a little easier to follow.
case when cast({{ dbt.dateadd('day', -1, "cast(current_year || '-03-01' as date)") }} as date) >= current_date | ||
then cast({{ dbt.dateadd('day', -1, "cast(current_year || '-03-01' as date)") }} as date) | ||
else cast({{ dbt.dateadd('day', -1, "cast(last_year || '-03-01' as date)") }} as date) |
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.
In this case I found it was easiest to go a day back from March to get the last day in Feb.
end as current_year_end_date, | ||
source_relation | ||
source_relation, | ||
case when financial_year_end_month = 2 and financial_year_end_day = 29 |
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.
Moving this condition first appears to prevent the warehouse from trying to execute the other nested conditions that cause the error.
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.
One small comment to possibly remove an unnecessary file, but otherwise looks good to go!
), year_end as ( | ||
|
||
-- Calculate the current financial year-end date for each organization: | ||
-- For February, determine last day by subtracting 1 day from March 1, avoiding leap year logic. |
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.
Brilliant!
integration_tests/tests/.gitkeep
Outdated
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.
Is this a necessary file? If not, can we remove it.
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.
Nope--removed!
Feature: Add Quickstart Model Counts to README
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.
Looks good! A question just for clarity:
- Do we see the leap year logic needing to be used elsewhere in the package in the future? If so, it makes more sense to abstract the leap year portion in a macro
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.
Additionally, I noticed that fields like account_class or source_type have all-caps values... should we do the same with account_name
? (Not really an issue, more of a standardization thing) . I can make an feature flag if it's significant enough cc @fivetran-joemarkiewicz
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.
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.
Per conversation with @fivetran-joemarkiewicz, this is the source behavior, so we'll keep as is.
@fivetran-reneeli That's the only place |
PR Overview
This PR will address the following Issue/Feature:
This PR will result in the following new package version:
Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:
PR Checklist
Basic Validation
Please acknowledge that you have successfully performed the following commands locally:
dbt run (if incremental models are present) && dbt testBefore marking this PR as "ready for review" the following have been applied:
Detailed Validation
Please share any and all of your validation steps:
I was able to recreate the error using seed data:
Error is resolved with updates.
Consistency tests passed using internal data. I could not use seed data for this test because of the error, but I wanted to make sure no changes occurred after the update.
Tested the update to
current_year_end_date
for when the previous fiscal year end falls in the same calendar year as but before today’s date.