Query editor
-- Turbine dashboard/Metrix shadow adapter over eight live facts and one-- serialized refresh receipt.---- Parameters (end_date is exclusive):-- {{chain}}: all | ethereum | base | unichain | arbitrum | bnb | polygon-- {{timeframe}}: all | daily | weekly | monthly-- {{end_date_mode}}: through_current_day | completed_days | custom-- {{start_date}}, {{end_date}}: YYYY-MM-DD---- Every metric row is deliberately non-additive across metric names. Verified-- production, shared/ambiguous, candidates, and all other excluded activity-- remain separate. No raw table or saved-query view is referenced here.WITH requested_params AS (SELECTCAST(LOWER('{{chain}}') AS VARCHAR(16)) AS requested_chain,CAST(LOWER('{{timeframe}}') AS VARCHAR(16)) AS timeframe,CAST(LOWER('{{end_date_mode}}') AS VARCHAR(20)) AS end_date_mode,CAST(CAST('{{start_date}}' AS TIMESTAMP) AS DATE) AS window_start,CAST(CAST('{{end_date}}' AS TIMESTAMP) AS DATE) AS requested_window_end,CAST(at_timezone(CURRENT_TIMESTAMP, 'UTC') AS DATE) AS utc_today,LOWER('{{chain}}') IN ('all', 'ethereum', 'base', 'unichain', 'arbitrum', 'bnb', 'polygon') AS has_supported_chain,LOWER('{{chain}}') IN ('all', 'ethereum') AS has_live_deployment,LOWER('{{timeframe}}') IN ('all', 'daily', 'weekly', 'monthly')AS has_supported_timeframe),resolved_params AS (SELECTrequested_chain,timeframe,end_date_mode,window_start,CASEWHEN end_date_mode = 'through_current_day'THEN date_add('day', 1, utc_today)WHEN end_date_mode = 'completed_days' THEN utc_todayWHEN end_date_mode = 'custom' THEN requested_window_endEND AS window_end,has_supported_chain,has_live_deployment,has_supported_timeframeFROM requested_params),params AS (SELECTrequested_chain,timeframe,end_date_mode,window_start,window_end,has_supported_chain,has_live_deployment,has_supported_timeframe,end_date_mode IN ('through_current_day', 'completed_days', 'custom')AS has_supported_end_date_mode,has_supported_chain