Hey Guys,
I’m starting to look into the Standard Native model coming off the back of the Standard Web model. First step is I’m looking at the SQL, screen_views was spot on no issues.
I’m now looking into sessions starting here
I’m particularly looking at 01-sessions-aggs.sql and this part of the snippet:
CREATE OR REPLACE TABLE {{.scratch_schema}}.mobile_sessions_aggregates{{.entropy}}
AS (
WITH events AS (
SELECT
es.session_id,
es.event_id,
es.event_name,
es.derived_tstamp,
es.build,
es.version,
es.event_index_in_session,
MAX(es.event_index_in_session) OVER (PARTITION BY es.session_id) AS events_in_session
FROM
{{.scratch_schema}}.mobile_events_staged{{.entropy}} es
)
, session_aggs AS (
SELECT
e.session_id,
--last dimensions
MAX(CASE WHEN e.event_index_in_session = e.events_in_session THEN e.build END) AS last_build,
MAX(CASE WHEN e.event_index_in_session = e.events_in_session THEN e.version END) AS last_version,
MAX(CASE WHEN e.event_index_in_session = e.events_in_session THEN e.event_name END) AS last_event_name,
MAX(CASE WHEN e.event_index_in_session = e.events_in_session THEN e.event_id END) AS session_last_event_id,
I’m stumped on event_index_in_session
what is this? I can’t find any previous mention of it anywhere else nor in my own staging, I do not have it.
Thanks,
Kyle