Merged PR 3020: new features dates

# Description

Added 2 new columns with a concatenation of month number and full name o short name

# Checklist

- [x] The edited models and dependants run properly with production data.
- [x] The edited models are sufficiently documented.
- [ ] The edited models contain PK tests, and I've ran and passed them.
- [ ] I have checked for DRY opportunities with other models and docs.
- [ ] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

new features dates
This commit is contained in:
Joaquin Ossa 2024-10-02 08:18:52 +00:00
commit bf01360fba
2 changed files with 50 additions and 1 deletions

View file

@ -1 +1,42 @@
with dates as (select * from {{ ref("int_dates") }}) select * from dates
with dates as (select * from {{ ref("int_dates") }})
select
date_day as date_day,
prior_date_day as prior_date_day,
next_date_day as next_date_day,
prior_year_date_day as prior_year_date_day,
prior_year_over_year_date_day as prior_year_over_year_date_day,
day_of_week as day_of_week,
day_of_week_name as day_of_week_name,
day_of_week_name_short as day_of_week_name_short,
day_of_month as day_of_month,
day_of_year as day_of_year,
week_start_date as week_start_date,
week_end_date as week_end_date,
prior_year_week_start_date as prior_year_week_start_date,
prior_year_week_end_date as prior_year_week_end_date,
week_of_year as week_of_year,
iso_week_start_date as iso_week_start_date,
iso_week_end_date as iso_week_end_date,
prior_year_iso_week_start_date as prior_year_iso_week_start_date,
prior_year_iso_week_end_date as prior_year_iso_week_end_date,
iso_week_of_year as iso_week_of_year,
prior_year_week_of_year as prior_year_week_of_year,
prior_year_iso_week_of_year as prior_year_iso_week_of_year,
month_of_year as month_of_year,
month_name as month_name,
month_name_short as month_name_short,
lpad(month_of_year::text, 2, '0') || '-' || month_name as month_number_name,
lpad(month_of_year::text, 2, '0')
|| '-'
|| month_name_short as month_number_name_short,
month_start_date as month_start_date,
month_end_date as month_end_date,
prior_year_month_start_date as prior_year_month_start_date,
prior_year_month_end_date as prior_year_month_end_date,
quarter_of_year as quarter_of_year,
quarter_start_date as quarter_start_date,
quarter_end_date as quarter_end_date,
year_number as year_number,
year_start_date as year_start_date,
year_end_date as year_end_date
from dates

View file

@ -125,6 +125,14 @@ models:
data_type: text
description: The month date day belongs to as a 3 digit shortened version.
- name: month_number_name
data_type: text
description: The month date number with leading zero and full month name (e.g., 01-January, 02-February).
- name: month_number_name_short
data_type: text
description: The month date number with leading zero and abbreviated month name (e.g., 01-Jan, 02-Feb).
- name: month_start_date
data_type: date
description: The full date for the first day of the month.