Nifi init

This commit is contained in:
2026-05-17 16:54:29 +02:00
parent 6203332841
commit 9cc58c20f4
15 changed files with 161 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
-- Returns one row per tournament with all natural keys needed for Oracle DIM lookups.
-- winner_org_id is NULL when the winner is an individual (Chess, StarCraft II, etc.)
SELECT
t.game_id,
CAST(DATE_FORMAT(t.start_date, '%Y%m%d') AS UNSIGNED) AS start_date_key,
CAST(DATE_FORMAT(t.end_date, '%Y%m%d') AS UNSIGNED) AS end_date_key,
o.organization_id AS winner_org_id,
t.event_name,
t.gender,
t.prize_pool_usd,
t.num_participants,
COALESCE(s.duration_days,
DATEDIFF(t.end_date, t.start_date) + 1) AS duration_days,
CASE WHEN t.club_championship_points = 1 THEN 1 ELSE 0
END AS has_club_points
FROM tournament t
LEFT JOIN schedule s ON t.tournament_id = s.tournament_id
LEFT JOIN organization o ON o.name = t.winner;