New created bookings with services model
This commit is contained in:
parent
ce723b335e
commit
fb2b2def52
1 changed files with 36 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
{{
|
||||
config(
|
||||
materialized="table",
|
||||
unique_key=["id_booking", "service_name", "date", "service_business_type"],
|
||||
)
|
||||
}}
|
||||
select
|
||||
-- Unique Key --
|
||||
icbs.id_booking,
|
||||
date(icbs.booking_created_date_utc) as date,
|
||||
coalesce(icbsd.service_name) as service_name,
|
||||
coalesce(icbsd.service_business_type, 'UNSET') as service_business_type,
|
||||
-- Dimensions --
|
||||
coalesce(icbs.id_deal, 'UNSET') as id_deal,
|
||||
case when icbsd.is_upgraded_service then 'YES' else 'NO' end as is_upgraded_service,
|
||||
coalesce(icbs.new_dash_version, 'UNSET') as new_dash_version,
|
||||
coalesce(
|
||||
icd.main_billing_country_iso_3_per_deal, 'UNSET'
|
||||
) as main_billing_country_iso_3_per_deal,
|
||||
coalesce(
|
||||
icmas.active_accommodations_per_deal_segmentation, 'UNSET'
|
||||
) as active_accommodations_per_deal_segmentation
|
||||
from {{ ref("int_core__booking_summary") }} as icbs
|
||||
inner join
|
||||
{{ ref("int_core__booking_service_detail") }} as icbsd
|
||||
on icbs.id_booking = icbsd.id_booking
|
||||
left join {{ ref("int_core__deal") }} as icd on icbs.id_deal = icd.id_deal
|
||||
left join
|
||||
{{ ref("int_kpis__dimension_daily_accommodation") }} as icmas
|
||||
on icbs.id_deal = icmas.id_deal
|
||||
and date(icbsd.service_detail_created_at_utc) = icmas.date
|
||||
where
|
||||
icbs.is_user_in_new_dash = true
|
||||
and icbs.is_missing_id_deal = false
|
||||
and icbsd.service_detail_created_at_utc
|
||||
>= icbs.user_in_new_dash_since_timestamp_at_utc
|
||||
Loading…
Add table
Add a link
Reference in a new issue