Skip to content

Commit

Permalink
Fix _date column in databricks
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-tomlein committed Aug 19, 2023
1 parent 9d9fb53 commit b39a7a0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ events_this_run as (
min(case when ev.event_type in ('adstart') then ev.start_tstamp end) as viewed_at,
max(ev.start_tstamp) as last_event

{% if target.type in ['databricks', 'spark'] -%}
, date(ev.viewed_at) as viewed_at_date
{%- endif %}

from events_this_run as ev

group by 1, 2, 3, 5, 6, 7, 8, 11

)

select * from prep
select *
{% if target.type in ['databricks', 'spark'] -%}
, date(prep.viewed_at) as viewed_at_date
{%- endif %}
from prep
2 changes: 1 addition & 1 deletion models/media_ads/snowplow_media_player_media_ads.sql
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ new_media_ad_views as (

select *
{% if target.type in ['databricks', 'spark'] -%}
, date(first_view) as first_view_date
, date(prep.first_view) as first_view_date
{%- endif %}

from prep
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ select
end as content_watched_percent

{% if target.type in ['databricks', 'spark'] -%}
, date(start_tstamp) as start_tstamp_date
, date(d.start_tstamp) as start_tstamp_date
{%- endif %}

from dedupe as d
Expand Down
2 changes: 1 addition & 1 deletion models/media_stats/snowplow_media_player_media_stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ select
l.last_base_tstamp,

{% if target.type in ['databricks', 'spark'] -%}
date(first_play) as first_play_date,
date(p.first_play) as first_play_date,
{%- endif %}

{% if is_incremental() %}
Expand Down

0 comments on commit b39a7a0

Please sign in to comment.