Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ dbt/logs/

# Optional fast-reset dump (generated by scripts/capture_initial_state.sh)
data/initial_state.dump

# Python bytecode from scripts/ (the loader container imports across script modules)
__pycache__/
124 changes: 91 additions & 33 deletions README.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions bin/add-partner
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Shim: create a new whitelabel brand's page-tracking schema in the warehouse.
# Usage: bin/add-partner <brand> [--full] [--rows N] | bin/add-partner <brand> --drop
set -euo pipefail
cd "$(dirname "$0")/.."
exec docker compose run --rm loader python scripts/add_partner.py "$@"
Empty file removed data/incremental/events/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions data/incremental/meridian_order_items/batch_001.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
order_item_id,order_id,seat_section,unit_price,quantity
oi_22,mo_22,Stalls,70.00,2
oi_23,mo_23,GA,44.00,2
3 changes: 3 additions & 0 deletions data/incremental/meridian_orders/batch_001.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
order_id,customer_id,performance_id,currency,subtotal,fees,total,status,placed_at
mo_22,MC-1007,mp_12,GBP,£140.00,£9.00,£149.00,paid,2025-02-10T10:00:00
mo_23,MC-1010,mp_7,GBP,88.00,6.00,94.00,paid,2025-02-11T11:00:00
3 changes: 3 additions & 0 deletions data/incremental/meridian_web_sessions/batch_001.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
session_id,cookie_id,customer_id,event_id,page_type,occurred_at
ws_26,ck_9019,,me_windrose,event_view,2025-02-10T09:00:00
ws_27,ck_9019,MC-1007,,checkout_start,2025-02-10T09:15:00
4 changes: 4 additions & 0 deletions data/incremental/whitelabel/wl_arcadia__pages/batch_001.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
page_id,visitor_id,account_id,page_type,occurred_at,event_id,showtime_id,utm_source,utm_medium,brand_code
arc_p_13,vis_arc_g7,acc_4,home,2025-03-18T08:22:10,,,google,cpc,ARC
arc_p_14,vis_arc_g7,acc_4,VIEWED_PRODUCT_PAGE,2025-03-18T08:25:44,evt_hamilton,,google,cpc,ARC
arc_p_15,vis_arc_g7,acc_4,viewed_showtime,2025-03-18T08:31:02,evt_hamilton,st_evt_hamilton_22,google,cpc,ARC
3 changes: 3 additions & 0 deletions data/incremental/whitelabel/wl_northgate__pages/batch_001.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
page_id,visitor_id,account_id,page_type,occurred_at,event_id,brand_code
ngt_p_10,vis_ngt_f6,,VIEWED PRODUCT PAGE,2025-03-19T12:04:33,evt_lion_king,NGT
ngt_p_11,vis_ngt_f6,acc_16,checkout_start,2025-03-19T12:11:57,evt_lion_king,NGT
17 changes: 17 additions & 0 deletions data/initial/meridian_customers.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
customer_id,full_name,email,phone,country,created_at,marketing_opt_in
MC-1001, Alice Whitfield , alice.whitfield@example.com ,+44 20 7946 0958,UK,2024-11-02T10:15:00,true
MC-1002,Ben Carter,ben.carter@example.com,+44 161 496 0001,uk,2024-11-05T09:00:00,false
MC-1003,Chiara Rossi,chiara.rossi@example.com,+39 06 4991 0000,Italy,2024-12-01T14:22:00,TRUE
MC-1004,Daniel Kim,daniel.kim@example.com,,South Korea,2025-01-10T08:45:00,
MC-1005,Emma Novak,EMMA.NOVAK@EXAMPLE.COM,+43 1 4000 0000,Austria,2025-01-14T11:00:00,false
MC-1006,Alice Whitfield,alice.whitfield@example.com,+44 20 7946 0958,United Kingdom,2025-01-20T09:30:00,true
MC-1007,Farid Haddad,farid.haddad@example.com,+33 1 4000 0000,France,2025-01-25T16:10:00,false
MC-1008, Grace Lin ,grace.lin@example.com,+44 20 1234 5678,UK,2025-02-01T12:00:00,true
MC-1009,,unknown_guest_09@example.com,,UK,2025-02-03T13:00:00,false
MC-1010,Ivy Chen,ivy.chen@example.com,+44 161 000 0000,uk,2025-02-05T15:45:00,TRUE
MC-1011,Jonas Weber,jonas.weber@example.com,+49 30 1234 5678,Germany,2025-02-08T10:00:00,false
MC-1012,Karolina Nowak,karolina.nowak@example.com,+48 22 000 0000,Poland,2025-02-10T09:15:00,true
MC-1013,Liam O'Sullivan,liam.osullivan@example.com,+353 1 234 5678,Ireland,2025-02-12T14:30:00,false
MC-1014,Maya Patel, maya.patel@example.com ,+44 20 7000 0000,UK,2025-02-15T11:20:00,TRUE
MC-1015,Noah Bergstrom,noah.bergstrom@example.com,+46 8 000 0000,Sweden,2025-02-18T17:00:00,false
MC-1016,Sam Reyes,user4@example.com,+44 20 5000 0000,UK,2025-02-20T09:00:00,true
6 changes: 6 additions & 0 deletions data/initial/meridian_events.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
event_id,title,venue_id,category
me_starlight, Starlight Revue ,mv_apollo, Theatre
me_windrose,Windrose,mv_globe,theatre
me_comedy_night,Comedy Night Live,mv_forum,COMEDY
me_midnight_opera, Midnight Opera ,mv_konzert,Opera
me_folk_tales,Folk Tales,mv_olympia,Theatre
25 changes: 25 additions & 0 deletions data/initial/meridian_order_items.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
order_item_id,order_id,seat_section,unit_price,quantity
oi_1a,mo_1,Stalls,70.00,1
oi_1b,mo_1,Circle,50.00,1
oi_2,mo_2, Stalls ,47.50,2
oi_3a,mo_3,Balcony,47.50,1
oi_3b,mo_3,Stalls,47.50,1
oi_4,mo_4,Stalls,70.00,2
oi_5,mo_5,GA,55.00,2
oi_6,mo_6,Stalls,65.00,2
oi_7,mo_7,Balcony,52.50,2
oi_8,mo_8,GA,49.50,2
oi_9,mo_9,Stalls,75.00,2
oi_10,mo_10,Stalls,56.00,2
oi_11a,mo_11,Balcony,70.00,1
oi_11b,mo_11,GA,50.00,1
oi_12,mo_12,GA,52.50,2
oi_13,mo_13,Stalls,59.00,2
oi_14,mo_14,Balcony,61.00,2
oi_15,mo_15,Stalls,67.50,2
oi_16,mo_16,Stalls,64.00,2
oi_17,mo_17,GA,49.50,2
oi_18,mo_18,Stalls,525.00,2
oi_19,mo_19,GA,50.00,2
oi_20,mo_20,GA,50.00,1
oi_21,mo_21,Merch,25.00,1
22 changes: 22 additions & 0 deletions data/initial/meridian_orders.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
order_id,customer_id,performance_id,currency,subtotal,fees,total,status,placed_at
mo_1,MC-1001,mp_1,GBP,£120.00,£8.00,£128.00,paid,2025-01-08T10:15:00
mo_2,MC-1002,mp_1,GBP,95.00,6.50,101.50, Paid ,2025-01-09T11:00:00
mo_3,MC-1003,mp_9,EUR,"95,00 €","6,00 €","101,00 €",PAID,2025-01-20T09:30:00
mo_4,MC-1004,mp_4,GBP,£140.00,£9.50,£149.50,paid,2025-01-05T14:00:00
mo_5,MC-1005,mp_9,EUR,110.00,7.00,117.00,paid,2025-01-22T16:45:00
mo_6,MC-1006,mp_2,GBP,£130.00,£8.50,£138.50,paid,2025-01-14T09:00:00
mo_7,MC-1007,mp_5,GBP,105.00,7.00,112.00,paid,2025-01-16T10:20:00
mo_8,MC-1008,mp_6,GBP,£99.00,£6.50,£105.50, refunded ,2025-01-24T15:10:00
mo_9,MC-1009,mp_7,GBP,150.00,10.00,160.00,paid,2025-01-30T18:00:00
mo_10,MC-1010,mp_8,GBP,£112.00,£7.50,£119.50,PARTIAL_REFUND,2025-02-02T12:00:00
mo_11,MC-1011,mp_9,EUR,"120,00 €","8,00 €","128,00 €",paid,2025-02-04T09:45:00
mo_12,MC-1012,mp_10,EUR,105.00,7.00,112.00,paid,2025-02-06T11:15:00
mo_13,MC-1013,mp_11,GBP,£118.00,£8.00,£126.00,paid,2025-01-13T13:30:00
mo_14,MC-1014,mp_12,GBP,122.00,8.00,130.00,Paid,2025-01-20T15:50:00
mo_15,MC-1001,mp_3,GBP,£135.00,£9.00,£144.00,paid,2025-01-22T10:05:00
mo_16,MC-1016,mp_2,GBP,£128.00,£8.50,£136.50,paid,2025-01-15T09:20:00
mo_17,MC-1002,mp_5,GBP,99.00,6.50,105.50, cancelled ,2025-01-18T08:40:00
mo_18,MC-1015,mp_6,SEK,"1050,00 kr","70,00 kr","1120,00 kr",paid,2025-01-27T10:00:00
mo_19,MC-1003,mp_10,EUR,100.00,6.50,106.50,paid,2025-02-09T14:20:00
mo_20,,mp_7,GBP,50.00,0.00,50.00,paid,2025-02-01T20:00:00
mo_21,MC-1013,,GBP,25.00,0.00,25.00,paid,2025-01-29T09:00:00
13 changes: 13 additions & 0 deletions data/initial/meridian_performances.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
performance_id,event_id,starts_at_local,utc_offset_minutes,doors_at_local
mp_1,me_starlight,2025-01-10 19:30:00,0,2025-01-10 18:45:00
mp_2,me_starlight,2025-01-17 19:30:00,0,2025-01-17 18:45:00
mp_3,me_starlight,2025-01-24 14:30:00,0,2025-01-24 13:45:00
mp_4,me_windrose,2025-01-12 20:00:00,0,2025-01-12 19:15:00
mp_5,me_windrose,2025-01-19 20:00:00,0,2025-01-19 19:15:00
mp_6,me_windrose,2025-01-26 15:00:00,0,2025-01-26 14:15:00
mp_7,me_comedy_night,2025-02-01 20:30:00,0,2025-02-01 19:45:00
mp_8,me_comedy_night,2025-02-08 20:30:00,0,2025-02-08 19:45:00
mp_9,me_midnight_opera,2025-02-05 19:00:00,60,2025-02-05 18:15:00
mp_10,me_midnight_opera,2025-02-12 19:00:00,60,2025-02-12 18:15:00
mp_11,me_folk_tales,2025-01-15 19:30:00,0,2025-01-15 18:45:00
mp_12,me_folk_tales,2025-01-22 19:30:00,0,2025-01-22 18:45:00
6 changes: 6 additions & 0 deletions data/initial/meridian_venues.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
venue_id,name,city,country
mv_apollo, Apollo Theatre ,London,UK
mv_globe,Globe Theatre,London,uk
mv_olympia,Olympia Theatre,Dublin,Ireland
mv_forum, The Forum ,Bath,United Kingdom
mv_konzert,Konzerthaus,Vienna,Austria
26 changes: 26 additions & 0 deletions data/initial/meridian_web_sessions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
session_id,cookie_id,customer_id,event_id,page_type,occurred_at
ws_1,ck_9001,,me_starlight,event_view,2025-01-02T09:00:00
ws_2,ck_9001,,me_starlight,performance_view,2025-01-02T09:05:00
ws_3,ck_9001,MC-1001,,checkout_start,2025-01-02T09:12:00
ws_4,ck_9002,,me_windrose,EVENT_VIEW,2025-01-03T11:00:00
ws_5,ck_9002,,me_windrose,performance_view,2025-01-03T11:04:00
ws_6,ck_9003,, me_comedy_night ,event_view,2025-01-05T13:00:00
ws_7,ck_9004,MC-1004,,checkout_start,2025-01-04T08:50:00
ws_8,ck_9004,MC-1004,,checkout_complete,2025-01-04T08:55:00
ws_9,ck_9005,,me_midnight_opera,Event_View,2025-01-06T17:00:00
ws_10,ck_9006,,me_starlight,event_view,2025-01-07T09:15:00
ws_11,ck_9006,MC-1006,,checkout_start,2025-01-14T08:45:00
ws_12,ck_9007,,me_folk_tales,event_view,2025-01-10T12:00:00
ws_13,ck_9008,,me_windrose,performance_view,2025-01-11T14:30:00
ws_14,ck_9009,,me_comedy_night,event_view,2025-01-15T09:00:00
ws_15,ck_9010,N/A,me_midnight_opera,event_view,2025-01-18T10:00:00
ws_16,ck_9011,,me_starlight,EVENT_VIEW,2025-01-20T11:00:00
ws_17,ck_9011,MC-1001,,checkout_start,2025-01-22T09:50:00
ws_18,ck_9012,,me_folk_tales,performance_view,2025-01-21T15:00:00
ws_19,ck_9013,,,event_view,2025-01-23T09:00:00
ws_20,ck_9014,MC-1016,,checkout_start,2025-01-15T09:00:00
ws_21,ck_9014,MC-1016,,checkout_complete,2025-01-15T09:05:00
ws_22,ck_9015,,me_windrose,event_view,2025-01-25T10:00:00
ws_23,ck_9016,,me_comedy_night,performance_view,2025-02-01T19:00:00
ws_24,ck_9017,NULL,me_midnight_opera,event_view,2025-02-03T14:00:00
ws_25,ck_9018,,me_folk_tales,event_view,2025-01-14T09:00:00
9 changes: 9 additions & 0 deletions data/whitelabel/partner_orpheum__page_views.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
view_id,cookie,member_ref,path,viewed_at,production_ref
orp_v_1,ck_orp_a1,acc_6,/,2025-01-16T09:11:40,
orp_v_2,ck_orp_a1,acc_6,/show/wicked,2025-01-16T09:14:02,evt_wicked
orp_v_3,ck_orp_b2,,/show/hamilton,2025-01-30T13:26:18,evt_hamilton
orp_v_4,ck_orp_b2,,/show/hamilton/performances,2025-01-30T13:29:44,evt_hamilton
orp_v_5,ck_orp_c3,acc_12,/checkout,2025-02-12T18:02:57,evt_six
orp_v_6,ck_orp_c3,acc_12,/checkout/confirmation,2025-02-12T18:09:31,evt_six
orp_v_7,ck_orp_d4,,/,2025-02-25T07:44:12,
orp_v_8,ck_orp_e5,acc_20,/show/aladdin,2025-03-07T16:38:25,evt_aladdin
13 changes: 13 additions & 0 deletions data/whitelabel/wl_arcadia__pages.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
page_id,visitor_id,account_id,page_type,occurred_at,event_id,showtime_id,utm_source,utm_medium,brand_code
arc_p_1,vis_arc_a1,acc_3,viewed_product_page,2025-01-14T11:02:11,evt_wicked,,google,cpc,ARC
arc_p_2,vis_arc_a1,acc_3,VIEWED_SHOWTIME,2025-01-14T11:04:52,evt_wicked,st_evt_wicked_1,google,cpc,ARC
arc_p_3,vis_arc_b2,,viewed product page,2025-01-19T18:44:03,evt_six,,,,ARC
arc_p_4,vis_arc_b2,N/A,checkout_start,2025-01-19T18:51:20,evt_six,,newsletter,email,ARC
arc_p_5,vis_arc_c3,acc_11,viewed_showtime ,2025-02-02T09:12:44,evt_hamilton,st_evt_hamilton_19,,,ARC
arc_p_6,vis_arc_c3,acc_11,checkout_complete,2025-02-02T09:20:05,evt_hamilton,st_evt_hamilton_19,,,ARC
arc_p_7,vis_arc_d4,NULL,home,2025-02-11T20:01:37,,,facebook,paid_social,ARC
arc_p_8,vis_arc_d4,,VIEWED_PRODUCT_PAGE,2025-02-11T20:03:59,evt_lion_king,,facebook,paid_social,ARC
arc_p_9,vis_arc_e5,acc_7,viewed_product_page,2025-02-24T13:30:12,evt_aladdin,,,,ARC
arc_p_10,vis_arc_e5,acc_7,viewed_showtime,2025-02-24T13:33:48,evt_lion_king,st_evt_lion_king_37,,,ARC
arc_p_11,vis_arc_f6,, home ,2025-03-05T07:55:02,,,google,organic,ARC
arc_p_12,vis_arc_f6,acc_15,checkout_start,2025-03-05T08:10:19,evt_book_of_mormon,,google,organic,ARC
11 changes: 11 additions & 0 deletions data/whitelabel/wl_lumen__pages.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
page_id,visitor_id,account_id,page_type,occurred_at,event_id,showtime_id,utm_source,utm_medium,brand_code,consent_state,device_type
lum_p_1,vis_lum_a1,acc_1,home,2025-01-11T12:00:04,,,direct,none,LUM,granted,mobile
lum_p_2,vis_lum_a1,acc_1,viewed_product_page,2025-01-11T12:02:47,evt_wicked,,direct,none,LUM,granted,mobile
lum_p_3,vis_lum_b2,,VIEWED_PRODUCT_PAGE,2025-01-27T15:31:22,evt_aladdin,,tiktok,paid_social,LUM,denied,mobile
lum_p_4,vis_lum_b2,N/A,viewed_showtime,2025-01-27T15:36:55,evt_wicked,st_evt_wicked_4,tiktok,paid_social,LUM,denied,mobile
lum_p_5,vis_lum_c3,acc_13,checkout_start,2025-02-14T17:48:30,evt_six,,,,LUM,granted,desktop
lum_p_6,vis_lum_c3,acc_13,checkout_complete,2025-02-14T17:55:11,evt_six,,,,LUM,granted,desktop
lum_p_7,vis_lum_d4,NULL,viewed showtime,2025-02-28T09:07:19,evt_hamilton,st_evt_hamilton_20,google,cpc,LUM,unknown,tablet
lum_p_8,vis_lum_e5,acc_18, home ,2025-03-09T22:14:06,,,,,LUM,granted,desktop
lum_p_9,vis_lum_e5,acc_18,viewed_product_page,2025-03-09T22:18:41,evt_deathly_hallows,,,,LUM,granted,desktop
lum_p_10,vis_lum_f6,,viewed_product_page,2025-03-15T11:29:53,evt_lion_king,,newsletter,email,LUM,granted,mobile
10 changes: 10 additions & 0 deletions data/whitelabel/wl_northgate__pages.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
page_id,visitor_id,account_id,page_type,occurred_at,event_id,brand_code
ngt_p_1,vis_ngt_a1,acc_2,viewed_product_page,2025-01-08T16:20:44,evt_lion_king,NGT
ngt_p_2,vis_ngt_a1,acc_2,VIEWED SHOWTIME,2025-01-08T16:24:10,evt_lion_king,NGT
ngt_p_3,vis_ngt_b2,,home,2025-01-21T10:05:31,,NGT
ngt_p_4,vis_ngt_b2,N/A,viewed_product_page,2025-01-21T10:09:57,evt_six,NGT
ngt_p_5,vis_ngt_c3,acc_9,checkout_start ,2025-02-06T19:41:02,evt_six,NGT
ngt_p_6,vis_ngt_c3,acc_9,checkout_complete,2025-02-06T19:47:38,evt_six,NGT
ngt_p_7,vis_ngt_d4,NULL,VIEWED_PRODUCT_PAGE,2025-02-19T08:33:15,evt_deathly_hallows,NGT
ngt_p_8,vis_ngt_e5,acc_5,viewed_showtime,2025-03-01T21:12:49,evt_hamilton,NGT
ngt_p_9,vis_ngt_e5,acc_5,home,2025-03-01T21:15:03,,NGT
4 changes: 4 additions & 0 deletions data/whitelabel/wl_sandbox__sessions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
session_id,visitor_id,started_at
sbx_s_1,vis_sbx_a1,2025-02-01T10:00:00
sbx_s_2,vis_sbx_b2,2025-02-01T10:15:22
sbx_s_3,vis_sbx_c3,2025-02-02T14:41:09
99 changes: 95 additions & 4 deletions dbt/models/sources.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Source tables (raw schema). Initial data loaded by scripts/load_initial_source_data.py;
# incremental data appended by scripts/ingest.py. Candidates model from source('raw', '<table>').
# Identity on pages: pages have both stable account_id and unstable customer_id; identity_merges applies to customer_id only.
# Source tables (raw schema). TodayTix tables loaded/appended as in the original platform;
# Meridian tables are the new MARI portfolio company being onboarded (loaded the same way).
# Candidates model from source('raw', '<table>').
# Identity on TTG pages: stable account_id + unstable customer_id; identity_merges resolves customer_id only.
# Identity on Meridian: NO merge log is provided. cookie_id is unstable and pre-login; customer_id is only
# populated once a session is tied to an account (e.g. at checkout). There is no table that maps cookie_id
# history the way identity_merges does for TTG — that gap is intentional, see README.
version: 2
sources:
- name: raw
schema: raw
description: Source tables loaded from data/initial/ and appended from data/incremental/
tables:
# ---- Existing TodayTix (TTG) platform — already staged; nothing above staging ----
- name: accounts
description: Stable account entity (e.g. logged-in user).
columns:
Expand Down Expand Up @@ -62,10 +67,96 @@ sources:
- name: showtime_id
description: Optional context (e.g. viewed showtime).
- name: identity_merges
description: Merge log for customer_id (e.g. Segment Unify). from_customer_id was merged into to_customer_id at merged_at. Use to resolve pages.customer_id to canonical id when building marts.
description: Merge log for TTG customer_id (e.g. Segment Unify). from_customer_id was merged into to_customer_id at merged_at. Use to resolve pages.customer_id to canonical id when building marts.
columns:
- name: from_customer_id
description: Id that was merged away (unstable/deprecated).
- name: to_customer_id
description: Canonical id that absorbed the merge.
- name: merged_at

# ---- Meridian Live (new MARI portfolio company) — onboarding target for this exercise ----
- name: meridian_customers
description: Meridian's account entity. No relationship to TTG accounts is provided — a shared real-world person may exist in both systems with no shared key other than (unreliable) email.
columns:
- name: customer_id
description: Primary key, Meridian format (e.g. MC-1001).
- name: full_name
description: Free text; sometimes blank (guest checkout).
- name: email
- name: phone
- name: country
- name: created_at
- name: marketing_opt_in
- name: meridian_venues
description: Physical venues Meridian sells tickets for. TTG's model has no venue entity today.
columns:
- name: venue_id
description: Primary key.
- name: name
- name: city
- name: country
- name: meridian_events
description: Shows/productions on Meridian, each tied to one venue.
columns:
- name: event_id
description: Primary key, Meridian format (e.g. me_starlight). Not the same id space as raw.events.
- name: title
- name: venue_id
description: FK to meridian_venues.
- name: category
description: Free text genre (e.g. Theatre, Comedy, Opera); casing inconsistent.
- name: meridian_performances
description: A specific occurrence of a Meridian event. TTG's equivalent (showtimes) stores start_at already normalized to UTC; Meridian does not.
columns:
- name: performance_id
description: Primary key.
- name: event_id
description: FK to meridian_events.
- name: starts_at_local
description: Naive local timestamp, no timezone. Must be combined with utc_offset_minutes to get a true instant.
- name: utc_offset_minutes
description: Offset from UTC in minutes for this performance's local time (varies by venue and DST).
- name: doors_at_local
- name: meridian_orders
description: Order header. Grain is one row per checkout, not per payment — there is no separate transactions table. Multi-currency; amounts are formatted inconsistently (symbols, thousands/decimal separators).
columns:
- name: order_id
description: Primary key.
- name: customer_id
description: Optional FK to meridian_customers; blank for anonymous/gift purchases.
- name: performance_id
description: Optional FK to meridian_performances; blank for non-ticket orders (e.g. merchandise).
- name: currency
description: ISO-ish currency code (GBP, EUR, SEK, USD).
- name: subtotal
- name: fees
- name: total
description: subtotal + fees, in the order's original currency, as formatted text.
- name: status
description: paid / refunded / partial_refund / cancelled. Casing and whitespace inconsistent.
- name: placed_at
- name: meridian_order_items
description: Ticket/merch line items within an order. An order may have multiple items at different price points — this is Meridian's natural grain, one level finer than meridian_orders.
columns:
- name: order_item_id
description: Primary key.
- name: order_id
description: FK to meridian_orders.
- name: seat_section
- name: unit_price
- name: quantity
- name: meridian_web_sessions
description: Browsing behavior on Meridian. cookie_id is the only pre-login identifier and is never resolved to a customer_id except when a session happens to convert — there is no merge/identity-resolution table like TTG's identity_merges for this source.
columns:
- name: session_id
description: Primary key.
- name: cookie_id
description: Unstable, anonymous browser identifier.
- name: customer_id
description: Populated only once known (e.g. checkout_start/checkout_complete); NULL/blank/N/A/NULL-string otherwise.
- name: event_id
description: Optional context; blank for account-level pages like checkout.
- name: page_type
description: Free text; casing and whitespace inconsistent.
- name: occurred_at
6 changes: 6 additions & 0 deletions dbt/models/staging/stg_accounts.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Existing platform (already built). Do not modify as part of this exercise.
select
account_id,
nullif(trim(email), '') as email,
created_at
from {{ source('raw', 'accounts') }}
6 changes: 6 additions & 0 deletions dbt/models/staging/stg_events.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Existing platform (already built). Do not modify as part of this exercise.
select
event_id,
trim(name) as name,
trim(slug) as slug
from {{ source('raw', 'events') }}
6 changes: 6 additions & 0 deletions dbt/models/staging/stg_identity_merges.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Existing platform (already built). Do not modify as part of this exercise.
select
from_customer_id,
to_customer_id,
merged_at
from {{ source('raw', 'identity_merges') }}
8 changes: 8 additions & 0 deletions dbt/models/staging/stg_orders.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- Existing platform (already built). Do not modify as part of this exercise.
select
order_id,
account_id,
nullif(trim(showtime_id), '') as showtime_id,
created_at,
replace(replace(trim(total_amount), '$', ''), ',', '')::numeric as total_amount
from {{ source('raw', 'orders') }}
Loading