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

Add column for non-ISO day_of_week #33

Merged
merged 5 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# dbt-date v0.2.8

## Features


## Fixes

* Switched `day_of_week` column in `get_date_dimension` from ISO to *not* ISO to align with the rest of the package. [#33](https://github.com/calogica/dbt-date/pull/33) (@davesgonechina)
* Added `day_of_week_iso` column to `get_date_dimension` [#33](https://github.com/calogica/dbt-date/pull/33) (@davesgonechina)
* Refactored Snowflake's `day_name` to not be ISO dependent [#33](https://github.com/calogica/dbt-date/pull/33) (@davesgonechina)

# dbt-date v0.2.7

## Features
Expand Down
16 changes: 8 additions & 8 deletions macros/calendar_date/day_name.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
dayname({{ date }})
{%- else -%}
-- long version not implemented on Snowflake so we're doing it manually :/
case {{ dbt_date.day_of_week(date) }}
when 1 then 'Monday'
when 2 then 'Tuesday'
when 3 then 'Wednesday'
when 4 then 'Thursday'
when 5 then 'Friday'
when 6 then 'Saturday'
when 7 then 'Sunday'
case dayname({{ date }})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

when 'Mon' then 'Monday'
when 'Tue' then 'Tuesday'
when 'Wed' then 'Wednesday'
when 'Thu' then 'Thursday'
when 'Fri' then 'Friday'
when 'Sat' then 'Saturday'
when 'Sun' then 'Sunday'
end
{%- endif -%}

Expand Down
6 changes: 3 additions & 3 deletions macros/get_date_dimension.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ select
{{ dbt_date.tomorrow('d.date_day') }} as next_date_day,
d.prior_year_date_day as prior_year_date_day,
d.prior_year_over_year_date_day,
{{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week,

{{ dbt_date.day_of_week('d.date_day', isoweek=false) }} as day_of_week,
{{ dbt_date.day_of_week('d.date_day', isoweek=true) }} as day_of_week_iso,
{{ dbt_date.day_name('d.date_day', short=false) }} as day_of_week_name,
{{ dbt_date.day_name('d.date_day', short=true) }} as day_of_week_name_short,
{{ dbt_date.day_of_month('d.date_day') }} as day_of_month,
Expand Down Expand Up @@ -129,4 +129,4 @@ select
from
dates_with_prior_year_dates d
order by 1
{% endmacro %}
{% endmacro %}