Skip to content

Commit

Permalink
Change event packing to sessions table
Browse files Browse the repository at this point in the history
  • Loading branch information
agregori97 committed Jul 11, 2024
1 parent 0b73fa9 commit 4a2b8b0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
29 changes: 28 additions & 1 deletion views/sessions.view.lkml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,34 @@ select se.session_date as session_date
, d.geo__metro
, d.geo__sub_continent
, d.geo__region) geo_data
, se.event_data event_data
, (SELECT AS STRUCT se.sl_key
, se.event_rank
, se.page_view_rank
, se.page_view_reverse_rank
, se.time_to_next_event
, se.time_to_next_page
, se.event_date
, se.event_timestamp
, se.event_name
, se.event_params
, se.event_previous_timestamp
, se.event_value_in_usd
, se.event_bundle_sequence_id
, se.event_server_timestamp_offset
, se.user_id
, se.user_pseudo_id
, se.user_properties
, se.user_first_touch_timestamp
, se.user_ltv
, se.device
, se.geo
, se.app_info
, se.traffic_source
, se.stream_id
, se.platform
, se.event_dimensions
, se.ecommerce
, se.items))) se.event_data event_data
from ${session_event_packing.SQL_TABLE_NAME} as se
left join ${session_tags.SQL_TABLE_NAME} as sa
on se.sl_key = sa.sl_key
Expand Down
3 changes: 1 addition & 2 deletions views/sessions/session_event_packing.view.lkml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ view: session_event_packing {
, sl.ga_session_number ga_session_number
, sl.user_pseudo_id user_pseudo_id
, sl.sl_key
, ARRAY_AGG(STRUCT(sl.sl_key
, sl.event_rank
, sl.page_view_rank
, sl.page_view_reverse_rank
Expand All @@ -44,7 +43,7 @@ view: session_event_packing {
, sl.platform
, sl.event_dimensions
, sl.ecommerce
, sl.items)) event_data
, sl.items
from ${session_list_with_event_history.SQL_TABLE_NAME} AS sl
WHERE sl.sl_key IN (SELECT sl_key FROM ${session_facts.SQL_TABLE_NAME}
WHERE CASE WHEN "@{EVENT_COUNT}" = "" THEN 1=1 WHEN "@{EVENT_COUNT}" != "" THEN
Expand Down

0 comments on commit 4a2b8b0

Please sign in to comment.