Skip to content

Commit

Permalink
Move custom sql to later in CTEs
Browse files Browse the repository at this point in the history
  • Loading branch information
rlh1994 committed May 9, 2024
1 parent f38555f commit 1f83cf5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions macros/base/base_create_snowplow_events_this_run.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0
) as session_identifier,
{%- endif %}
e.*
{% if custom_sql %}
, {{ custom_sql }}
{% endif %}

from {{ snowplow_events }} e

)

select
a.*,
b.user_identifier -- take user_identifier from manifest. This ensures only 1 domain_userid per session.
a.*
,b.user_identifier -- take user_identifier from manifest. This ensures only 1 domain_userid per session.
{% if custom_sql %}
, {{ custom_sql }}
{% endif %}

from identified_events as a
inner join {{ sessions_this_run }} as b
Expand Down Expand Up @@ -169,9 +169,6 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0
) as session_identifier,
{%- endif %}
e.*
{% if custom_sql %}
, {{ custom_sql }}
{%- endif %}

from {{ snowplow_events }} e
{% if unique_session_identifiers|length > 0 %}
Expand Down Expand Up @@ -203,7 +200,11 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0

)

select *
select
e.*
{% if custom_sql %}
, {{ custom_sql }}
{%- endif %}

from events_this_run as e
{%- if entities_or_sdes -%}
Expand Down

0 comments on commit 1f83cf5

Please sign in to comment.