TICKIT-02: Build the TICKIT Star Schema
Track: TICKIT Marketplace • Difficulty: Intermediate • Mastery Points: 150 PTS
Business Problem Scenario
To eliminate transactional database contention and accelerate analytical BI queries across both buyer and seller cohorts, TICKIT Marketplace is migrating to an enterprise dimensional star schema in Delta Lake. You must author the production DDL for gold.fact_sales, incorporating integer surrogate keys to isolate the warehouse from upstream OLTP key churn, declaring primary key integrity (informational RELY constraint), and configuring Databricks liquid clustering on high-cardinality query dimensions (date_sk, event_sk).
Engineering Objective
Write the CREATE OR REPLACE TABLE gold.fact_sales DDL statement in Delta Lake. • Target Schema Columns: sales_sk BIGINT NOT NULL, salesid INT NOT NULL, listid INT NOT NULL, buyer_sk BIGINT NOT NULL, seller_sk BIGINT NOT NULL, event_sk BIGINT NOT NULL, date_sk INT NOT NULL, qtysold INT NOT NULL, pricepaid DECIMAL(10,2) NOT NULL, commission DECIMAL(10,2) NOT NULL. • Integrity Constraints: PRIMARY KEY (sales_sk) RELY (informational constraint guiding query planning). • Storage Optimization: USING DELTA, CLUSTER BY (date_sk, event_sk). Key Concepts: - Surrogate Keys: System-generated integer keys insulating analytical schemas from upstream operational key reassignments. - Liquid Clustering: Modern Delta Lake clustering optimizing read performance without manual partition management.
Target Table: gold.fact_sales (sales_sk BIGINT, salesid INT, listid INT, buyer_sk BIGINT, seller_sk BIGINT, event_sk BIGINT, date_sk INT, qtysold INT, pricepaid DECIMAL(10,2), commission DECIMAL(10,2))
Verification & Architecture Insights
Decoupling buyer and seller surrogate keys ensures dimension queries never collide or produce ambiguous entity attributes during regional cohort reporting.