CROSS JOIN UNNEST()

in src/data/gleanSql.js [29:55]


  CROSS JOIN UNNEST(e.events) AS event
  WHERE
    -- Pick yesterday's data from stable/historical tables.
    -- https://docs.telemetry.mozilla.org/cookbooks/bigquery/querying.html#table-layout-and-naming
    date(submission_timestamp) = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
    AND sample_id = 1 -- 1% sample for development
    AND event.category = '${additionalInfo.category}'
    AND event.name = '${additionalInfo.name}'
)
SELECT * FROM events
-- IMPORTANT: Remove the limit clause when the query is ready.
LIMIT 10`;

export const getGleanEventQuery = (table, additionalInfo) => `
-- Auto-generated by the Glean Dictionary.
-- https://docs.telemetry.mozilla.org/cookbooks/accessing_glean_data.html#event-metrics

WITH events AS (
  SELECT
    -- The table is partitioned by submission timestamp, so we need to
    -- include it in the query. We use event_timestamp instead to understand
    -- when the event happened exactly at the source.
    submission_timestamp,
    event_timestamp,
    event,
    event_extra
  FROM ${table} as e