Skip to content

Commit

Permalink
Update base_create_snowplow_events_this_run.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
ilias1111 committed Oct 28, 2024
1 parent a795167 commit 6a39207
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions macros/base/base_create_snowplow_events_this_run.sql
Original file line number Diff line number Diff line change
Expand Up @@ -282,19 +282,18 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0
NULL
) as session_identifier,
{%- endif %}
e.*,
row_number() over (partition by event_id order by {{ session_timestamp }}, dvce_created_tstamp) as event_id_dedupe_index

e.*
from {{ snowplow_events }} e

)

main_logic as (
select
a.*
,b.user_identifier -- take user_identifier from manifest. This ensures only 1 domain_userid per session.
{% if custom_sql %}
, {{ custom_sql }}
{% endif %}
,row_number() over (partition by event_id order by {{ session_timestamp }}, dvce_created_tstamp) as event_id_dedupe_index

from identified_events as a
inner join {{ sessions_this_run }} as b
Expand All @@ -316,8 +315,10 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0
{% endif %}

and {{ snowplow_utils.app_id_filter(app_ids) }}

and a.event_id_dedupe_index = 1
)
SELECT *
FROM main_logic
WHERE event_id_dedupe_index = 1
{% endset %}

{{ return(events_this_run_query) }}
Expand Down

0 comments on commit 6a39207

Please sign in to comment.