Merged PR 3451: Adds Deal Daily Lifecycle and metrics

# Description

Changes:
* Creates lifecycle_daily_deal, metric_daily_deals and agg_daily_deals. These follow a different strategy due to the nature of the metrics
* Modifies the dimension macro to ensure deal dimension is included in all models except these ones
* Fixes production issue on currently deployed deal lifecycle and metrics

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #23566
This commit is contained in:
Oriol Roqué Paniagua 2024-11-07 10:49:06 +00:00
parent 9ef9a57c03
commit 8c23f91242
7 changed files with 821 additions and 6 deletions

View file

@ -6,7 +6,7 @@ Assumes a host will have a deal being filled.
{{ config(materialized="table", unique_key=["date", "id_deal"]) }}
with
int_core__bookings as (select * from {{ ref("int_core__bookings") }}),
int_core__unified_user as (select * from {{ ref("int_core__unified_user") }}),
int_core__user_host as (select * from {{ ref("int_core__user_host") }}),
int_dates_mtd as (select * from {{ ref("int_dates_mtd") }}),
int_hubspot__deal as (select * from {{ ref("int_hubspot__deal") }}),
@ -44,10 +44,10 @@ with
max(b.created_date_utc) as last_time_booked_date_utc,
max(b.previous_booked_date) as second_to_last_time_booked_date_utc
from int_dates_mtd d
inner join int_core__unified_user h on d.date >= h.created_date_utc
inner join int_core__user_host h on d.date >= date(h.created_date_utc)
left join
booked_days_per_host b
on h.id_user = b.id_user_host
on h.id_user_host = b.id_user_host
and d.date >= b.created_date_utc
where h.id_deal is not null
group by d.date, h.id_deal