|
1 | 1 | # Push Messaging Cadence
|
2 | 2 | view: push_messaging_cadence {
|
3 |
| - derived_table: { |
4 |
| - sql: select to_timestamp(sends.time) as send_timestamp, |
5 |
| - sends.user_id as send_user_id, |
6 |
| - bounces.user_id as bounce_user_id, |
7 |
| - sends.message_variation_id as s_message_variation_id, |
8 |
| - sends.canvas_step_id as s_canvas_step_id, |
9 |
| - sends.campaign_name as s_campaign_name, |
10 |
| - sends.canvas_name as s_canvas_name, |
11 |
| - sends.platform as s_platform, |
12 |
| - sends.id as send_id, |
13 |
| - opens.id as open_id, |
14 |
| - bounces.id as bounce_id, |
15 |
| - rank() over (partition by send_user_id order by send_timestamp asc) as send_event, |
16 |
| - iff(timediff(second, send_timestamp, to_timestamp(opens.time))=min(timediff(second, send_timestamp, to_timestamp(opens.time))) over (partition by open_id), true, false) as min_open_difference, |
17 |
| - iff(timediff(second, send_timestamp, to_timestamp(bounces.time))=min(timediff(second, send_timestamp, to_timestamp(bounces.time))) over (partition by bounce_id), true, false) as min_bounce_difference, |
18 |
| - min(send_timestamp) over (partition by send_user_id order by send_timestamp asc) as first_sent, |
19 |
| - datediff(day, lag(send_timestamp) over (partition by send_user_id order by send_timestamp asc), send_timestamp) as diff_days, |
20 |
| - datediff(week, lag(send_timestamp) over (partition by send_user_id order by send_timestamp asc), send_timestamp) as diff_weeks |
21 |
| -FROM PROD_ANALYTICS.ANALYTICS_PROCESSED.VW_MP_BRAZE_PUSH_NOTIFICATION_SEND AS sends |
22 |
| -LEFT JOIN PROD_ANALYTICS.ANALYTICS_PROCESSED.VW_MP_BRAZE_PUSH_NOTIFICATION_OPEN AS opens ON (sends.user_id)=(opens.user_id) |
23 |
| - AND |
24 |
| - (sends.device_id)=(opens.device_id) |
25 |
| - AND |
26 |
| - ((sends.message_variation_id)=(opens.message_variation_id) |
27 |
| - OR |
28 |
| - (sends.canvas_step_id)=(opens.canvas_step_id)) |
29 |
| -LEFT JOIN PROD_ANALYTICS.ANALYTICS_PROCESSED.VW_MP_BRAZE_PUSH_NOTIFICATION_BOUNCE AS bounces ON (sends.user_id)=(bounces.user_id) |
30 |
| - AND |
31 |
| - (sends.device_id)=(bounces.device_id) |
32 |
| - AND |
33 |
| - ((sends.message_variation_id)=(bounces.message_variation_id) |
34 |
| - OR |
35 |
| - (sends.canvas_step_id)=(bounces.canvas_step_id)) ;; |
| 3 | + sql_table_name: PROD_ANALYTICS.ANALYTICS_PROCESSED.TBL_BRAZE_PUSH_CADENCE ;; |
36 | 4 | }
|
37 | 5 |
|
38 | 6 | dimension_group: send {
|
|
0 commit comments