Skip to content

sources.ended_events

Typed projection of bet365.ended_events. Casts the JSON data column into proper ClickHouse types (UInt32 / String / Date), normalises the short_score separator from : to -, and forwards the event_partition_key and extracted_at fields verbatim. Incremental + ReplacingMergeTree, partitioned by event_partition_key.

flowchart LR
raw[(bet365.ended_events)] --> me[/sources.ended_events/]
me --> c1[/calculations.inplay_1_by_minute/]
me --> c5[/calculations.matches_5_score/]
me --> mart[/mart.matches/]
click raw "/raw/ended_events/" "Open raw"
click c1 "/calculations/inplay_1_by_minute/" "Open inplay_1_by_minute"
click c5 "/calculations/matches_5_score/" "Open matches_5_score"
click mart "/mart/matches/" "Open mart.matches"
ColumnDescriptionFormula
event_idUnique identifier for the event.data.id::UInt32
sport_idIdentifier for the sport category.data.sport_id::UInt16
event_dateEvent date (YYYY-MM-DD).toDate(data.time::UInt32)
event_partition_keyClickHouse partition key.passthrough from raw
event_countTotal events for this event_date/sport_id (validation aid).passthrough from raw
time_status_idTime status code (joined to seeds__time_status).data.time_status::UInt8
league_idLeague identifier.data.league.id::UInt32
league_nameLeague name.data.league.name::String
league_country_codeISO country code of the league.data.league.cc::String
team_home_idHome-team identifier.data.home.id::UInt32
team_home_nameHome-team name.data.home.name::String
team_home_image_idHome-team logo image id.toUInt32OrZero(toString(data.home.image_id))
team_home_country_codeHome-team ISO country code.data.home.cc::String
team_away_idAway-team identifier.data.away.id::UInt32
team_away_nameAway-team name.data.away.name::String
team_away_image_idAway-team logo image id.toUInt32OrZero(toString(data.away.image_id))
team_away_country_codeAway-team ISO country code.data.away.cc::String
short_scoreFinal score, normalised (H-A).case … position(toString(data.ss),':') > 0 then replace(toString(data.ss), ':', '-') else toString(data.ss) end; ''/'null' mapped to NULL.
round_idRound identifier.toUInt16OrZero(toString(data.round))
extracted_atCrawl timestamp from the raw row.passthrough