summaryrefslogtreecommitdiffstats
path: root/tests/fixtures/schema1/01_schema.json
blob: 9b3156df922dc75f0beb48270488fcd9e060c9ab (plain)
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
{
    "name": "schema1",
    "label": "test schema1",
    "pg_dsn": "fixme",
    "search_path": ["schema1"],
    "cubes": [
        {
            "name": "facts1",
            "label": "Facts 1",
            "fact_table": "facts",
            "key": "id",
            "joins": [
                {
                    "name": "innersubcategory",
                    "table": "subcategory",
                    "master": "innersubcategory_id",
                    "detail": "id",
                    "kind": "inner"
                },
                {
                    "name": "leftsubcategory",
                    "table": "subcategory",
                    "master": "leftsubcategory_id",
                    "detail": "id",
                    "kind": "left"
                },
                {
                    "name": "rightsubcategory",
                    "table": "subcategory",
                    "master": "rightsubcategory_id",
                    "detail": "id",
                    "kind": "right"
                },
                {
                    "name": "outersubcategory",
                    "table": "subcategory",
                    "master": "outersubcategory_id",
                    "detail": "id",
                    "kind": "full"
                },
                {
                    "name": "innercategory",
                    "table": "category",
                    "master": "innersubcategory.category_id",
                    "detail": "id",
                    "kind": "inner"
                },
                {
                    "name": "leftcategory",
                    "table": "category",
                    "master": "leftsubcategory.category_id",
                    "detail": "id",
                    "kind": "left"
                },
                {
                    "name": "rightcategory",
                    "table": "category",
                    "master": "rightsubcategory.category_id",
                    "detail": "id",
                    "kind": "right"
                },
                {
                    "name": "outercategory",
                    "table": "category",
                    "master": "outersubcategory.category_id",
                    "detail": "id",
                    "kind": "full"
                }
            ],
            "dimensions": [
                {
                    "name": "date",
                    "label": "Date",
                    "type": "date",
                    "value": "date"
                },
                {
                    "name": "hour",
                    "type": "integer",
                    "label": "Hour",
                    "value": "EXTRACT(hour from datetime)"
                },
                {
                    "name": "innersubcategory",
                    "label": "Inner SubCategory",
                    "type": "integer",
                    "join": ["innercategory", "innersubcategory"],
                    "value": "innersubcategory.id",
                    "value_label": "innersubcategory.label"
                },
                {
                    "name": "leftsubcategory",
                    "label": "Left SubCategory",
                    "type": "integer",
                    "join": ["leftcategory", "leftsubcategory"],
                    "value": "leftsubcategory.id",
                    "value_label": "leftsubcategory.label"
                },
                {
                    "name": "rightsubcategory",
                    "label": "Right SubCategory",
                    "type": "integer",
                    "join": ["rightcategory", "rightsubcategory"],
                    "value": "rightsubcategory.id",
                    "value_label": "rightsubcategory.label"
                },
                {
                    "name": "outersubcategory",
                    "label": "Outer SubCategory",
                    "type": "integer",
                    "join": ["outercategory", "outersubcategory"],
                    "value": "outersubcategory.id",
                    "value_label": "outersubcategory.label"
                },
                {
                    "name": "innercategory",
                    "label": "Inner Category",
                    "type": "integer",
                    "join": ["innersubcategory", "innercategory"],
                    "value": "innercategory.id",
                    "value_label": "innercategory.label"
                },
                {
                    "name": "leftcategory",
                    "label": "Left Category",
                    "type": "integer",
                    "join": ["leftsubcategory", "leftcategory"],
                    "value": "leftcategory.id",
                    "value_label": "leftcategory.label"
                },
                {
                    "name": "rightcategory",
                    "label": "Right Category",
                    "type": "integer",
                    "join": ["rightsubcategory", "rightcategory"],
                    "value": "rightcategory.id",
                    "value_label": "rightcategory.label"
                },
                {
                    "name": "outercategory",
                    "label": "Outer Category",
                    "type": "integer",
                    "join": ["outersubcategory", "outercategory"],
                    "value": "outercategory.id",
                    "value_label": "outercategory.label"
                }
            ],
            "measures": [
                {
                    "name": "simple_count",
                    "label": "number of rows",
                    "type": "integer",
                    "expression": "count({fact_table}.id)"
                },
                {
                    "name": "aggregated_count",
                    "label": "sum of cnt",
                    "type": "integer",
                    "expression": "sum(cnt)"
                },
                {
                    "name": "percent",
                    "label": "pourcentage des demandes",
                    "type": "percent",
                    "expression": "case (select count({fact_table}.id) from {table_expression} where {where_conditions}) when 0 then null else count({fact_table}.id) * 100. / (select count({fact_table}.id) from {table_expression} where {where_conditions}) end"
                }
            ]
        }
    ]
}