Skip to content

sources.odds

Typed projection of bet365.odds, unfolded one row per (event, odd snapshot). The raw JSON array data.1_1 (full-time 1×2 odds) is exploded with array join, with each odd field pulled through its typed subcolumn (.:String) so missing keys come through as proper SQL NULLs instead of the ClickHouse ᴺᵁᴸᴸ marker. Filtered to minute_elapsed <= 180 to drop garbage rows. Incremental + ReplacingMergeTree, partitioned by event_partition_key.

flowchart LR
raw[(bet365.odds)] --> me[/sources.odds/]
me --> c1[/calculations.inplay_1_by_minute/]
me --> m1[/calculations.matches_1_odds_prematch/]
click raw "/raw/odds/" "Open raw"
click c1 "/calculations/inplay_1_by_minute/" "Open inplay_1_by_minute"
click m1 "/calculations/matches_1_odds_prematch/" "Open matches_1_odds_prematch"
ColumnDescriptionFormula
keyUnique key for every event (passed through).passthrough from raw
event_idBet365 event identifier.passthrough from raw
event_dateEvent date.passthrough from raw
event_partition_keyClickHouse partition key.passthrough from raw
odd_idIdentifier of the unfolded odd snapshot.ifNull(toUInt32OrZero(odd.id.:String), 0)
minute_elapsedMatch minute the odd was recorded at.toUInt32OrZero(odd.time_str.:String)
short_scoreScore string normalised to H-A, NULL when blank.case when odd.ss.:String is null or odd.ss.:String = '' then null else replaceOne(odd.ss.:String, ':', '-') end
home_oddHome decimal odd; '-' mapped to NULL.case when odd.home_od.:String = '-' then null else toFloat64OrNull(odd.home_od.:String) end
draw_oddDraw decimal odd; '-' mapped to NULL.case when odd.draw_od.:String = '-' then null else toFloat64OrNull(odd.draw_od.:String) end
away_oddAway decimal odd; '-' mapped to NULL.case when odd.away_od.:String = '-' then null else toFloat64OrNull(odd.away_od.:String) end
is_in_play1 when this is an in-play snapshot (score present), 0 for prematch.case when odd.ss.:String is null or odd.ss.:String = '' then 0 else 1 end
odd_add_timeServer-time the odd was registered, as DateTime.toDateTime(toUInt32OrZero(odd.add_time.:String))
extracted_atCrawl timestamp from the raw row.passthrough