Skip to content

Commit 62aeeb3

Browse files
committed
Extend test schema / dataset with RetailCalendar
1 parent 89d3d37 commit 62aeeb3

File tree

4 files changed

+1012
-2
lines changed

4 files changed

+1012
-2
lines changed

packages/cubejs-testing-drivers/fixtures/_schemas.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@
258258
"name": "Customers",
259259
"relationship": "belongs_to",
260260
"sql": "{CUBE}.customer_id = {Customers}.customer_id"
261+
},
262+
{
263+
"name": "RetailCalendar",
264+
"relationship": "many_to_one",
265+
"sql": "{CUBE}.order_date = {RetailCalendar.date_val}"
261266
}
262267
],
263268
"dimensions": [
@@ -389,6 +394,36 @@
389394
"type": "prior"
390395
}]
391396
},
397+
{
398+
"name": "totalProfitRetailYearAgo",
399+
"type": "number",
400+
"sql": "{totalProfit}",
401+
"multi_stage": true,
402+
"time_shift": [{
403+
"interval": "1 year",
404+
"type": "prior"
405+
}]
406+
},
407+
{
408+
"name": "totalProfitRetailMonthAgo",
409+
"type": "number",
410+
"sql": "{totalProfit}",
411+
"multi_stage": true,
412+
"time_shift": [{
413+
"interval": "1 month",
414+
"type": "prior"
415+
}]
416+
},
417+
{
418+
"name": "totalProfitRetailWeekAgo",
419+
"type": "number",
420+
"sql": "{totalProfit}",
421+
"multi_stage": true,
422+
"time_shift": [{
423+
"interval": "1 week",
424+
"type": "prior"
425+
}]
426+
},
392427
{
393428
"name": "totalProfitForStatus",
394429
"type": "sum",
@@ -462,6 +497,55 @@
462497
}
463498
}
464499
]
500+
},
501+
{
502+
"name": "RetailCalendar",
503+
"calendar": true,
504+
"dimensions": [
505+
{
506+
"name": "date_val",
507+
"sql": "date_val",
508+
"type": "time",
509+
"primary_key": true,
510+
"shown": true
511+
},
512+
{
513+
"name": "retail_date",
514+
"sql": "date_val",
515+
"type": "time",
516+
"granularities": [
517+
{
518+
"name": "week",
519+
"sql": "{CUBE}.retail_week_begin_date"
520+
},
521+
{
522+
"name": "quarter",
523+
"sql": "{CUBE}.retail_quarter_begin_date"
524+
},
525+
{
526+
"name": "year",
527+
"sql": "{CUBE}.retail_year_begin_date"
528+
}
529+
],
530+
"timeShift": [
531+
{
532+
"interval": "1 month",
533+
"type": "prior",
534+
"sql": "{CUBE}.retail_date_prev_month"
535+
},
536+
{
537+
"interval": "1 quarter",
538+
"type": "prior",
539+
"sql": "{CUBE}.retail_date_prev_quarter"
540+
},
541+
{
542+
"interval": "1 year",
543+
"type": "prior",
544+
"sql": "{CUBE}.retail_date_prev_year"
545+
}
546+
]
547+
}
548+
]
465549
}
466550
]
467551
}

0 commit comments

Comments
 (0)