File tree Expand file tree Collapse file tree 3 files changed +69
-15
lines changed Expand file tree Collapse file tree 3 files changed +69
-15
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,45 @@ models:
12
12
values :
13
13
- weekend
14
14
- weekday
15
+ - name : month_name_short
16
+ description : The short name of the month
17
+ tests :
18
+ - not_null
19
+ - accepted_values :
20
+ values :
21
+ - Jan
22
+ - Feb
23
+ - Mar
24
+ - Apr
25
+ - May
26
+ - Jun
27
+ - Jul
28
+ - Aug
29
+ - Sep
30
+ - Oct
31
+ - Nov
32
+ - Dec
33
+ - name : day_of_month
34
+ description : The day of the month
35
+ tests :
36
+ - not_null
37
+ - dbt_expectations.expect_column_values_to_be_between :
38
+ min_value : 1
39
+ max_value : 31
40
+ - name : day_of_year
41
+ description : The day of the year
42
+ tests :
43
+ - not_null
44
+ - dbt_expectations.expect_column_values_to_be_between :
45
+ min_value : 1
46
+ max_value : 366
47
+ - name : week_of_year
48
+ description : The week of the year
49
+ tests :
50
+ - not_null
51
+ - dbt_expectations.expect_column_values_to_be_between :
52
+ min_value : 0
53
+ max_value : 53
15
54
16
55
- name : dim_time
17
56
description : A dimension table of time
Original file line number Diff line number Diff line change 8
8
description : Month of the year
9
9
tests :
10
10
- not_null
11
- - accepted_values :
12
- values :
13
- - 1
14
- - 2
15
- - 3
16
- - 4
17
- - 5
18
- - 6
19
- - 7
20
- - 8
21
- - 9
22
- - 10
23
- - 11
24
- - 12
11
+ - dbt_expectations.expect_column_values_to_be_between :
12
+ min_value : 1
13
+ max_value : 12
25
14
- name : year
26
15
description : Year
27
16
tests :
@@ -42,10 +31,22 @@ models:
42
31
description : Name of the day of the week of the peak moment of the month
43
32
tests :
44
33
- not_null
34
+ - accepted_values :
35
+ values :
36
+ - Monday
37
+ - Tuesday
38
+ - Wednesday
39
+ - Thursday
40
+ - Friday
41
+ - Saturday
42
+ - Sunday
45
43
- name : month_peak_day_of_month
46
44
description : Day of the month of the peak moment of the month
47
45
tests :
48
46
- not_null
47
+ - dbt_expectations.expect_column_values_to_be_between :
48
+ min_value : 1
49
+ max_value : 31
49
50
- name : month_peak_day_type
50
51
description : Type of the day of the peak moment of the month
51
52
tests :
@@ -58,6 +59,16 @@ models:
58
59
description : Whether the peak moment of the month is a holiday
59
60
tests :
60
61
- not_null
62
+ - name : month_peak_part_of_day
63
+ description : Part of the day of the peak moment of the month
64
+ tests :
65
+ - not_null
66
+ - accepted_values :
67
+ values :
68
+ - morning
69
+ - afternoon
70
+ - evening
71
+ - night
61
72
- name : month_peak_value
62
73
description : Peak value of the month
63
74
tests :
Original file line number Diff line number Diff line change @@ -13,10 +13,13 @@ components as (
13
13
u .from_timestamp ,
14
14
u .to_timestamp ,
15
15
u .usage * 4 as quarter_power,
16
- dd.*
16
+ dd.* ,
17
+ tt.*
17
18
from usage_data u
18
19
left join {{ ref(' dim_dates' ) }} dd
19
20
on u .from_timestamp ::date = dd .date_day
21
+ left join {{ ref(' dim_time' ) }} tt
22
+ on u .from_timestamp ::time = tt .moment
20
23
),
21
24
22
25
month_peaks as (
@@ -43,6 +46,7 @@ with_avg as (
43
46
d .day_type as month_peak_day_type,
44
47
d .is_holiday as month_peak_is_holiday,
45
48
p .month_peak as month_peak_value,
49
+ d .part_of_day as month_peak_part_of_day,
46
50
avg (p .month_peak ) over (rows between 11 preceding and current row) as month_peak_12month_avg,
47
51
from components d
48
52
join month_peaks p
You can’t perform that action at this time.
0 commit comments