Query editor
-- Sandwich pipeline, stage S7 for one UTC day: aggregates for the time series. One row per (day, tier, venue).-- Dollar profit and materiality are not aggregated here: they are valued in the rolling view with outside prices only.-- Tier 1 and 2 rows come from the enriched table; Tier 3 (pattern-only) rows are counts from the chunk tables.-- The builder column stays for a stable schema and holds 'n/a': builder breakdowns are read from the rolling views, which-- join the attribution tables (sw_attr_<day>), so a corrected attribution never leaves stale builders here.-- Tokens: DAY, CHUNKS, ENRICHED.WITH chunks AS (SELECT * FROM dune.blockspace_forensics_consortium.result_sw_chunk_20261130_p1),e AS (SELECT * FROM dune.blockspace_forensics_consortium.result_sw_day_20261130),t12 AS (SELECT date '2026-11-30' AS day, tier, 'n/a' AS builder, project || '/' || version AS venue, 'n/a' AS materiality,count(*) AS instances, sum(n_victims) AS victims, sum(victims_usd) AS victims_usd, cast(NULL AS double) AS profit_usd, sum(gas_usd) AS gas_usd,count(*) FILTER (WHERE e1) AS with_e1, count(*) FILTER (WHERE variant = 'multi_victim') AS multi_victimFROM e GROUP BY 1, 2, 3, 4, 5),t3 AS (SELECT date '2026-11-30' AS day, 3 AS tier, 'n/a' AS builder, project || '/' || version AS venue, 'n/a' AS materiality,count(*), sum(n_victims), sum(victims_usd), cast(NULL AS double), cast(NULL AS double),count(*) FILTER (WHERE e1), count(*) FILTER (WHERE variant = 'multi_victim')FROM chunks WHERE tier = 3 GROUP BY 1, 2, 3, 4, 5)SELECT * FROM t12 UNION ALL SELECT * FROM t3