set references for v1
This commit is contained in:
parent
2cd115eede
commit
f58e97a3f2
7 changed files with 60 additions and 36 deletions
|
|
@ -1,6 +1,6 @@
|
|||
with
|
||||
int_core__verification_payments as (
|
||||
select * from {{ ref("int_core__verification_payments") }}
|
||||
select * from {{ ref("int_core__verification_payments", version=1) }}
|
||||
),
|
||||
stg_core__guest_satisfaction_responses as (
|
||||
select * from {{ ref("stg_core__guest_satisfaction_responses") }}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ with
|
|||
select * from {{ ref("int_core__verification_requests") }}
|
||||
),
|
||||
int_core__verification_payments as (
|
||||
select * from {{ ref("int_core__verification_payments") }}
|
||||
select * from {{ ref("int_core__verification_payments", version=1) }}
|
||||
),
|
||||
int_dates_by_deal as (select * from {{ ref("int_dates_by_deal") }}),
|
||||
int_core__unified_user as (select * from {{ ref("int_core__unified_user") }}),
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ with
|
|||
select * from {{ ref("int_core__verification_requests") }}
|
||||
),
|
||||
int_core__verification_payments as (
|
||||
select * from {{ ref("int_core__verification_payments") }}
|
||||
select * from {{ ref("int_core__verification_payments", version=1) }}
|
||||
),
|
||||
int_dates_by_deal as (select * from {{ ref("int_dates_by_deal") }}),
|
||||
int_core__unified_user as (select * from {{ ref("int_core__unified_user") }}),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
This model provides Month-To-Date (MTD) based on Guest Journey metrics.
|
||||
|
||||
*/
|
||||
|
||||
{% set dimensions = get_kpi_dimensions() %}
|
||||
|
||||
{{ config(materialized="table", unique_key=["date", "dimension", "dimension_value"]) }}
|
||||
|
|
@ -12,14 +11,16 @@ with
|
|||
select * from {{ ref("int_core__verification_requests") }}
|
||||
),
|
||||
int_core__verification_payments as (
|
||||
select * from {{ ref("int_core__verification_payments") }}
|
||||
select * from {{ ref("int_core__verification_payments", version=1) }}
|
||||
),
|
||||
int_core__user_host as (select * from {{ ref("int_core__user_host") }}),
|
||||
int_core__mtd_accommodation_segmentation as (
|
||||
select * from {{ ref("int_core__mtd_accommodation_segmentation") }}
|
||||
),
|
||||
int_dates_mtd as (select * from {{ ref("int_dates_mtd") }}),
|
||||
int_dates_mtd_by_dimension as (select * from {{ ref("int_dates_mtd_by_dimension") }}),
|
||||
int_dates_mtd_by_dimension as (
|
||||
select * from {{ ref("int_dates_mtd_by_dimension") }}
|
||||
),
|
||||
|
||||
first_payment_per_verification_request as (
|
||||
select
|
||||
|
|
@ -46,11 +47,13 @@ with
|
|||
and extract(day from vr.created_date_utc) <= d.day
|
||||
{% if dimension.dimension == "'by_number_of_listings'" %}
|
||||
inner join int_core__user_host u on vr.id_user_host = u.id_user_host
|
||||
inner join int_core__mtd_accommodation_segmentation mas
|
||||
inner join
|
||||
int_core__mtd_accommodation_segmentation mas
|
||||
on u.id_deal = mas.id_deal
|
||||
and d.date = mas.date
|
||||
{% elif dimension.dimension == "'by_billing_country'" %}
|
||||
inner join int_core__user_host u
|
||||
inner join
|
||||
int_core__user_host u
|
||||
on vr.id_user_host = u.id_user_host
|
||||
and u.main_billing_country_iso_3_per_deal is not null
|
||||
{% endif %}
|
||||
|
|
@ -71,15 +74,19 @@ with
|
|||
from int_dates_mtd d
|
||||
inner join
|
||||
int_core__verification_requests vr
|
||||
on date_trunc('month', vr.verification_estimated_started_date_utc)::date = d.first_day_month
|
||||
and extract(day from vr.verification_estimated_started_date_utc) <= d.day
|
||||
on date_trunc('month', vr.verification_estimated_started_date_utc)::date
|
||||
= d.first_day_month
|
||||
and extract(day from vr.verification_estimated_started_date_utc)
|
||||
<= d.day
|
||||
{% if dimension.dimension == "'by_number_of_listings'" %}
|
||||
inner join int_core__user_host u on vr.id_user_host = u.id_user_host
|
||||
inner join int_core__mtd_accommodation_segmentation mas
|
||||
inner join
|
||||
int_core__mtd_accommodation_segmentation mas
|
||||
on u.id_deal = mas.id_deal
|
||||
and d.date = mas.date
|
||||
{% elif dimension.dimension == "'by_billing_country'" %}
|
||||
inner join int_core__user_host u
|
||||
inner join
|
||||
int_core__user_host u
|
||||
on vr.id_user_host = u.id_user_host
|
||||
and u.main_billing_country_iso_3_per_deal is not null
|
||||
{% endif %}
|
||||
|
|
@ -100,15 +107,21 @@ with
|
|||
from int_dates_mtd d
|
||||
inner join
|
||||
int_core__verification_requests vr
|
||||
on date_trunc('month', vr.verification_estimated_completed_date_utc)::date = d.first_day_month
|
||||
and extract(day from vr.verification_estimated_completed_date_utc) <= d.day
|
||||
on date_trunc(
|
||||
'month', vr.verification_estimated_completed_date_utc
|
||||
)::date
|
||||
= d.first_day_month
|
||||
and extract(day from vr.verification_estimated_completed_date_utc)
|
||||
<= d.day
|
||||
{% if dimension.dimension == "'by_number_of_listings'" %}
|
||||
inner join int_core__user_host u on vr.id_user_host = u.id_user_host
|
||||
inner join int_core__mtd_accommodation_segmentation mas
|
||||
inner join
|
||||
int_core__mtd_accommodation_segmentation mas
|
||||
on u.id_deal = mas.id_deal
|
||||
and d.date = mas.date
|
||||
{% elif dimension.dimension == "'by_billing_country'" %}
|
||||
inner join int_core__user_host u
|
||||
inner join
|
||||
int_core__user_host u
|
||||
on vr.id_user_host = u.id_user_host
|
||||
and u.main_billing_country_iso_3_per_deal is not null
|
||||
{% endif %}
|
||||
|
|
@ -129,17 +142,24 @@ with
|
|||
from int_dates_mtd d
|
||||
inner join
|
||||
first_payment_per_verification_request p
|
||||
on date_trunc('month', p.first_payment_paid_date_utc)::date = d.first_day_month
|
||||
on date_trunc('month', p.first_payment_paid_date_utc)::date
|
||||
= d.first_day_month
|
||||
and extract(day from p.first_payment_paid_date_utc) <= d.day
|
||||
{% if dimension.dimension == "'by_number_of_listings'" %}
|
||||
inner join int_core__verification_requests vr on vr.id_verification_request = p.id_verification_request
|
||||
inner join
|
||||
int_core__verification_requests vr
|
||||
on vr.id_verification_request = p.id_verification_request
|
||||
inner join int_core__user_host u on vr.id_user_host = u.id_user_host
|
||||
inner join int_core__mtd_accommodation_segmentation mas
|
||||
inner join
|
||||
int_core__mtd_accommodation_segmentation mas
|
||||
on u.id_deal = mas.id_deal
|
||||
and d.date = mas.date
|
||||
{% elif dimension.dimension == "'by_billing_country'" %}
|
||||
inner join int_core__verification_requests vr on vr.id_verification_request = p.id_verification_request
|
||||
inner join int_core__user_host u
|
||||
inner join
|
||||
int_core__verification_requests vr
|
||||
on vr.id_verification_request = p.id_verification_request
|
||||
inner join
|
||||
int_core__user_host u
|
||||
on vr.id_user_host = u.id_user_host
|
||||
and u.main_billing_country_iso_3_per_deal is not null
|
||||
{% endif %}
|
||||
|
|
@ -173,22 +193,23 @@ select
|
|||
cast(pym.paid_guest_journeys as decimal)
|
||||
/ coym.completed_guest_journeys as payment_rate_guest_journey
|
||||
from int_dates_mtd_by_dimension d
|
||||
left join
|
||||
created_year_month cym
|
||||
left join
|
||||
created_year_month cym
|
||||
on cym.date = d.date
|
||||
and cym.dimension = d.dimension
|
||||
and cym.dimension = d.dimension
|
||||
and cym.dimension_value = d.dimension_value
|
||||
left join
|
||||
started_year_month sym
|
||||
left join
|
||||
started_year_month sym
|
||||
on d.date = sym.date
|
||||
and d.dimension = sym.dimension
|
||||
and d.dimension = sym.dimension
|
||||
and d.dimension_value = sym.dimension_value
|
||||
left join
|
||||
left join
|
||||
completed_year_month coym
|
||||
on d.date = coym.date
|
||||
and d.dimension = coym.dimension
|
||||
and d.dimension = coym.dimension
|
||||
and d.dimension_value = coym.dimension_value
|
||||
left join paid_year_month pym
|
||||
left join
|
||||
paid_year_month pym
|
||||
on d.date = pym.date
|
||||
and d.dimension = pym.dimension
|
||||
and d.dimension = pym.dimension
|
||||
and d.dimension_value = pym.dimension_value
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ This model provides Month-To-Date (MTD) based on Guest Revenue metrics.
|
|||
{{ config(materialized="table", unique_key=["date", "dimension", "dimension_value"]) }}
|
||||
with
|
||||
int_core__verification_payments as (
|
||||
select * from {{ ref("int_core__verification_payments") }}
|
||||
select * from {{ ref("int_core__verification_payments", version=1) }}
|
||||
),
|
||||
int_core__verification_requests as (
|
||||
select * from {{ ref("int_core__verification_requests") }}
|
||||
|
|
@ -62,7 +62,8 @@ with
|
|||
from int_dates_mtd d
|
||||
inner join
|
||||
int_core__verification_payments vp
|
||||
on date_trunc('month', vp.payment_paid_date_utc)::date = d.first_day_month
|
||||
on date_trunc('month', vp.payment_paid_date_utc)::date
|
||||
= d.first_day_month
|
||||
and extract(day from vp.payment_paid_date_utc) <= d.day
|
||||
{% if dimension.dimension == "'by_number_of_listings'" %}
|
||||
inner join int_core__user_host u on vp.id_user_host = u.id_user_host
|
||||
|
|
@ -71,7 +72,9 @@ with
|
|||
on u.id_deal = mas.id_deal
|
||||
and d.date = mas.date
|
||||
{% elif dimension.dimension == "'by_billing_country'" %}
|
||||
inner join int_core__user_host u on vp.id_user_host = u.id_user_host
|
||||
inner join
|
||||
int_core__user_host u
|
||||
on vp.id_user_host = u.id_user_host
|
||||
and u.main_billing_country_iso_3_per_deal is not null
|
||||
{% endif %}
|
||||
where upper(vp.payment_status) = {{ var("paid_payment_state") }}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ with
|
|||
amount_in_gbp,
|
||||
payment_status,
|
||||
payment_paid_date_utc
|
||||
from {{ ref("int_core__verification_payments") }}
|
||||
from {{ ref("int_core__verification_payments", version=1) }}
|
||||
where
|
||||
verification_payment_type = 'CheckInCover' -- 5 is check-in cover
|
||||
and payment_status in ('Paid', 'Refunded')
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
with
|
||||
int_core__verification_payments as (
|
||||
select * from {{ ref("int_core__verification_payments") }}
|
||||
select * from {{ ref("int_core__verification_payments", version=1) }}
|
||||
)
|
||||
select
|
||||
vp.id_verification_to_payment as id_verification_to_payment,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue