This exercise builds the complete BI layer for the IPL analytics platform: a Superset-equivalent virtual dataset backed by the dbt Gold mart models from Module 3, row-level security filters for franchise-level data access, and an embedded analytics JWT token generation system. Using DuckDB as the warehouse backend, you will implement the virtual dataset SQL, apply RLS filters for two franchise users, verify that each user sees only their team's data, and validate that the economy_rate metric is correctly computed from aggregated counts rather than averaged pre-computed ratios.
The exercise covers two steps. Step 1 builds the virtual dataset and tests three chart type query patterns — a bar chart aggregating by bowler, a time series aggregating by match_date, and a table view with cross-filter support. Step 2 implements RLS for two franchise users and verifies that the RLS-filtered queries produce non-overlapping, correctly scoped result sets with aggregate totals that sum to the full dataset's total.
Analogy🏏Cricket
🏏 Think of it like cricket: OLTP is the IPL's live ticketing counter — it handles thousands of simultaneous seat reservations, each requiring a precise single-seat record update with immediate confirmation. Speed per transaction and data consistency under concurrent updates are everything. OLAP is the IPL's season statistics department — it runs complex analytical queries across every ball bowled in every match of every season to produce the published rankings, economy rates, and historical comparisons. No one books a seat through the statistics department, and no broadcaster calls the ticketing counter for Bumrah's career economy rate. The two workloads demand completely different systems. Just as the ticketing counter is built for speed and correctness on one seat at a time and would buckle if asked to tally a decade of attendance mid-sale, an OLTP row-store excels at single-record writes but chokes on full-table aggregation; and just as the statistics department pores over millions of past deliveries but would be hopeless at booking a live seat under contention, the OLAP columnar engine sweeps billions of rows yet is the wrong tool for a fast single-row update. The physical design of each — row-oriented for the counter, columnar for the stats desk — is what makes it superb at its own job and unfit for the other's.
🏏 Showing the Cricket analogy — a Cricket version isn’t available for this concept yet.