Skip to content

Commit

Permalink
Merge pull request #33 from davesgonechina/patch-1
Browse files Browse the repository at this point in the history
Add column for non-ISO day_of_week
  • Loading branch information
clausherther authored Jun 3, 2021
2 parents f877c86 + 7893f51 commit 370d472
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
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 }})
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 %}

0 comments on commit 370d472

Please sign in to comment.