with raw as (select date_trunc('day', block_timestamp) as dt, event_contract, count(distinct tx_id) as tx_count
from flow.core.fact_events
where date(block_timestamp) >= '2022-05-08'
group by 1,2),
labels as (select *
from flow.core.dim_contract_labels)
select *
from raw a
left join labels b on a.event_contract = b.event_contract