Merged PR 3440: New metrics for payments from guest journeys
# Description Added new metrics to the int_kpis__metric_daily_guest_payments model for all payments associated to bookings that have not been cancelled. This have been created for the Guest KPIs report # 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. - [ ] I have checked for DRY opportunities with other models and docs. - [ ] 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: #23371
This commit is contained in:
commit
dc4f5098a1
2 changed files with 13 additions and 3 deletions
|
|
@ -1,13 +1,17 @@
|
||||||
{% set deposit_fees_verification_payment_type_items = "('FEE')" %}
|
{% set deposit_fees_verification_payment_type_items = "('FEE')" %}
|
||||||
{% set waiver_fees_verification_payment_type_items = "('WAIVER')" %}
|
{% set waiver_fees_verification_payment_type_items = "('WAIVER')" %}
|
||||||
{% set checkin_cover_fees_verification_payment_type_items = "('CHECKINCOVER')" %}
|
{% set checkin_cover_fees_verification_payment_type_items = "('CHECKINCOVER')" %}
|
||||||
|
{% set id_check = "('GOVERNMENTID')" %}
|
||||||
|
|
||||||
{{ config(materialized="table", unique_key=["date", "id_deal"]) }}
|
{{ config(materialized="table", unique_key=["date", "id_deal", "has_id_check"]) }}
|
||||||
|
|
||||||
select
|
select
|
||||||
-- Unique Key --
|
-- Unique Key --
|
||||||
icvp.payment_paid_date_utc as date,
|
icvp.payment_paid_date_utc as date,
|
||||||
coalesce(icuh.id_deal, 'UNSET') as id_deal,
|
coalesce(icuh.id_deal, 'UNSET') as id_deal,
|
||||||
|
case
|
||||||
|
when icv.id_verification is null then 'W/O Id Check' else 'With Id Check'
|
||||||
|
end as has_id_check,
|
||||||
-- Dimensions --
|
-- Dimensions --
|
||||||
coalesce(
|
coalesce(
|
||||||
icd.main_billing_country_iso_3_per_deal, 'UNSET'
|
icd.main_billing_country_iso_3_per_deal, 'UNSET'
|
||||||
|
|
@ -60,6 +64,10 @@ from {{ ref("int_core__verification_payments", version=2) }} as icvp
|
||||||
left join
|
left join
|
||||||
{{ ref("int_core__verification_requests") }} as icvr
|
{{ ref("int_core__verification_requests") }} as icvr
|
||||||
on icvp.id_verification_request = icvr.id_verification_request
|
on icvp.id_verification_request = icvr.id_verification_request
|
||||||
|
left join
|
||||||
|
{{ ref("stg_core__verification") }} as icv
|
||||||
|
on icv.id_verification_request = icvr.id_verification_request
|
||||||
|
and upper(icv.verification) = {{ id_check }}
|
||||||
left join
|
left join
|
||||||
{{ ref("int_core__user_host") }} as icuh on icvr.id_user_host = icuh.id_user_host
|
{{ ref("int_core__user_host") }} as icuh on icvr.id_user_host = icuh.id_user_host
|
||||||
left join {{ ref("int_core__deal") }} as icd on icuh.id_deal = icd.id_deal
|
left join {{ ref("int_core__deal") }} as icd on icuh.id_deal = icd.id_deal
|
||||||
|
|
@ -68,4 +76,4 @@ left join
|
||||||
on icuh.id_deal = icmas.id_deal
|
on icuh.id_deal = icmas.id_deal
|
||||||
and icvp.payment_paid_date_utc = icmas.date
|
and icvp.payment_paid_date_utc = icmas.date
|
||||||
where upper(icvp.payment_status) = {{ var("paid_payment_state") }}
|
where upper(icvp.payment_status) = {{ var("paid_payment_state") }}
|
||||||
group by 1, 2, 3, 4
|
group by 1, 2, 3, 4, 5
|
||||||
|
|
|
||||||
|
|
@ -1811,13 +1811,15 @@ models:
|
||||||
The unique key corresponds to the deepest granularity of the model,
|
The unique key corresponds to the deepest granularity of the model,
|
||||||
in this case:
|
in this case:
|
||||||
- date,
|
- date,
|
||||||
- id_deal.
|
- id_deal,
|
||||||
|
- has_id_check.
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
- dbt_utils.unique_combination_of_columns:
|
- dbt_utils.unique_combination_of_columns:
|
||||||
combination_of_columns:
|
combination_of_columns:
|
||||||
- date
|
- date
|
||||||
- id_deal
|
- id_deal
|
||||||
|
- has_id_check
|
||||||
|
|
||||||
columns:
|
columns:
|
||||||
- name: date
|
- name: date
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue