-
Notifications
You must be signed in to change notification settings - Fork 35
/
DefaultNamespace-Tables.hjson
173 lines (173 loc) · 4.46 KB
/
DefaultNamespace-Tables.hjson
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
{
tables: [
{
name: NetflixTitles
description: Netflix Titles
table: netflix_titles
dbConnectionName: DemoConnection
dimensions: [
{
name: title_id_values
friendlyName: Title Id Values
cardinality: medium
category: Attributes
type: TEXT
definition: '{{$title_id}}'
}
{
name: title_id
friendlyName: Title Id
cardinality: medium
category: Attributes
type: TEXT
definition: '{{$title_id}}'
tableSource: {
table: NetflixTitles
column: title_id_values
suggestionColumns: ['title', 'show_type']
}
}
{
name: show_type
friendlyName: Show Type
// Not necessary if values are provided
// cardinality: tiny
category: Attributes
type: TEXT
definition: '{{$type}}'
values: ['TV Show', 'Movie']
}
{
name: title
friendlyName: Title
cardinality: medium
category: Attributes
type: TEXT
definition: '{{$title}}'
}
{
name: director
friendlyName: Director
cardinality: small
category: Attributes
type: TEXT
definition: '{{$director}}'
}
{
name: cast
friendlyName: Cast List
cardinality: large
category: Attributes
type: TEXT
definition: '{{$cast_list}}'
}
{
name: country
friendlyName: Countries
cardinality: small
category: Attributes
type: TEXT
definition: '{{$country}}'
}
{
name: date_available
friendlyName: Available Since
category: Date
type: TIME
definition: '{{$date_added}}'
grains: [
{
type: DAY
sql : '''
PARSEDATETIME(FORMATDATETIME({{$$column.expr}}, 'yyyy-MM-dd'), 'yyyy-MM-dd')
'''
}
{
type: WEEK
sql : '''
PARSEDATETIME(FORMATDATETIME({{$$column.expr}}, 'YYYY-ww'), 'YYYY-ww')
'''
}
{
type: ISOWEEK
sql : '''
DATEADD('DAY', 1, PARSEDATETIME(FORMATDATETIME({{$$column.expr}}, 'YYYY-ww'), 'YYYY-ww'))
'''
}
{
type: MONTH
sql : '''
PARSEDATETIME(FORMATDATETIME({{$$column.expr}}, 'yyyy-MM'), 'yyyy-MM')
'''
}
{
type: YEAR
sql : '''
PARSEDATETIME(YEAR({{$$column.expr}}), 'yyyy')
'''
}
]
}
{
name: release_year
friendlyName: Release Year
category: Date
type: TIME
definition: '{{$release_year}}'
grains: [
{
type: YEAR
}
]
}
{
name: film_rating
friendlyName: Film Rating
cardinality: tiny
category: Attributes
type: TEXT
definition: '{{$rating}}'
}
{
name: genres
friendlyName: Genre
cardinality: small
category: Attributes
type: TEXT
definition: '{{$listed_in}}'
}
{
name: description
friendlyName: Description
cardinality: large
category: Attributes
type: TEXT
definition: '{{$description}}'
}
]
measures: [
{
name: count
friendlyName: Title Count
category: Stats
type: INTEGER
definition: 'count({{title_id}})'
}
{
name: total_seasons
friendlyName: Total Seasons
category: Stats
type: INTEGER
definition: "sum(cast (case when {{$duration}} like '% Seasons' then REPLACE({{$duration}}, ' Seasons', '') else '0' end AS INT))"
}
{
name: movie_duration
friendlyName: Duration (in mins)
category: Stats
type: INTEGER
definition: "sum(cast (case when {{$duration}} like '% min' then REPLACE({{$duration}}, ' min', '') else '0' end AS INT))"
}
]
}
]
}