Menu ▾ ▴

#33 feat: Cube.js schema and view definitions

closed
nobody
None
2026-06-12
2026-06-12
Anonymous
No

Originally created by: grynn-in

Summary

  • 4 Cube.js schemas: trial_balance, consolidated_trial_balance, scenario_trial_balance, allocation_results
  • 4 Cube.js views: balance_sheet, pnl_report, budget_vs_actual, consolidated_report

Test plan

  • [ ] cube/cube.js picks up new schema/view YAML files
  • [ ] Cube.js playground shows all 4 cubes and 4 views

🤖 Generated with Claude Code

Related

Tickets: #33

Discussion

  • Anonymous

    Anonymous - 2026-06-12

    Originally posted by: grynn-in

    Code Review: PR [#33] — Cube.js schemas & views

    Verdict: REQUEST CHANGES — 3 issues (1 critical, 2 medium)

    1. CRITICAL: Views won't load

    cube.js sets schemaPath: '/cube/schema' but views are in /cube/views/. Cube.js only scans the schemaPath directory. Views will be silently ignored.

    Fix options:

    • (a) Move view files into cube/schema/ (simplest)
    • (b) Update cube.js to set schemaPath to /cube and restructure

    2. MEDIUM: meta.sql_filter has no effect

    Views v_balance_sheet and v_pnl_report use meta.sql_filter: trial_balance.is_balance_sheet = true. The meta block in Cube.js views is arbitrary metadata — it does NOT apply a SQL filter. These views will return ALL trial_balance rows unfiltered.

    Fix: Create cube-level segments:

    # In trial_balance.yml, add segments:
    segments:
    
    - name: balance_sheet_only
      sql: "{CUBE}.is_balance_sheet = true"
    - name: pnl_only
      sql: "{CUBE}.is_pnl = true"
    

    Or create filtered cubes (trial_balance_bs, trial_balance_pnl) with SQL subqueries. Views alone can't apply WHERE filters.

    3. MEDIUM: Hardcoded dynamic dimensions

    dim_cost_center, dim_department, dim_business_unit are hardcoded in cube schemas, but the dbt model generates them dynamically via dim_select(). When users add/remove dimensions through the schema lifecycle (konsol PR [#6]), cube schemas go stale.

    Acceptable for now (manual sync) but should be documented.

    What's correct

    • scenario_trial_balance CASE WHEN measures correctly pivot the amount column — good pattern
    • allocation_results columns match the macro output
    • consolidated_trial_balance dimensions and measures are accurate
    • All sql_table references point to correct epm_gold.* tables
     

    Related

    Tickets: #33
    Tickets: #6

  • Anonymous

    Anonymous - 2026-06-12

    Ticket changed by: grynn-in

    • status: open --> closed
     

Log in to post a comment.