Updated all PK in created and chargeable services models

This commit is contained in:
Joaquin Ossa 2024-12-02 12:42:47 +01:00
parent 3015c12e18
commit 7e8e403dec
7 changed files with 35 additions and 9 deletions

View file

@ -1,14 +1,19 @@
{{ config(materialized="table", unique_key=["id_booking", "service_name", "date"]) }}
{{
config(
materialized="table",
unique_key=["id_booking", "service_name", "date", "service_business_type"],
)
}}
select
-- Unique Key --
icbs.id_booking,
icbsd.service_last_chargeable_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,
icbs.id_accommodation,
case when icbsd.is_upgraded_service then 'YES' else 'NO' end as is_upgraded_service,
coalesce(icbsd.service_business_type, 'UNSET') as service_business_type,
coalesce(icbs.new_dash_version, 'UNSET') as new_dash_version,
coalesce(
icd.main_billing_country_iso_3_per_deal, 'UNSET'

View file

@ -1,13 +1,18 @@
{{ config(materialized="table", unique_key=["id_booking", "service_name", "date"]) }}
{{
config(
materialized="table",
unique_key=["id_booking", "service_name", "date", "service_business_type"],
)
}}
select
-- Unique Key --
icbs.id_booking,
date(icbsd.service_detail_created_at_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(icbsd.service_business_type, 'UNSET') as service_business_type,
coalesce(icbs.new_dash_version, 'UNSET') as new_dash_version,
coalesce(
icd.main_billing_country_iso_3_per_deal, 'UNSET'

View file

@ -6,6 +6,7 @@
"service_name",
"id_booking",
"active_accommodations_per_deal_segmentation",
"service_business_type",
],
)
}}
@ -17,10 +18,10 @@ select
cs.id_booking,
cs.service_name,
cs.active_accommodations_per_deal_segmentation,
cs.service_business_type,
-- Dimensions --
cs.id_deal,
cs.id_accommodation,
cs.service_business_type,
cs.new_dash_version,
cs.is_upgraded_service,
cs.main_billing_country_iso_3_per_deal,

View file

@ -6,6 +6,7 @@
"service_name",
"id_deal",
"active_accommodations_per_deal_segmentation",
"service_business_type",
],
)
}}
@ -17,8 +18,8 @@ select
cs.service_name,
cs.active_accommodations_per_deal_segmentation,
cs.id_deal,
-- Dimensions --
cs.service_business_type,
-- Dimensions --
cs.new_dash_version,
cs.is_upgraded_service,
cs.main_billing_country_iso_3_per_deal,

View file

@ -6,6 +6,7 @@
"id_booking",
"service_name",
"active_accommodations_per_deal_segmentation",
"service_business_type",
],
)
}}
@ -18,10 +19,10 @@ select
cs.id_booking,
cs.service_name,
cs.active_accommodations_per_deal_segmentation,
cs.service_business_type,
-- Dimensions --
cs.id_deal,
cs.id_accommodation,
cs.service_business_type,
cs.new_dash_version,
cs.is_upgraded_service,
cs.main_billing_country_iso_3_per_deal,

View file

@ -6,6 +6,7 @@
"service_name",
"id_deal",
"active_accommodations_per_deal_segmentation",
"service_business_type",
],
)
}}
@ -17,8 +18,8 @@ select
cs.service_name,
cs.active_accommodations_per_deal_segmentation,
cs.id_deal,
-- Dimensions --
cs.service_business_type,
-- Dimensions --
cs.new_dash_version,
cs.is_upgraded_service,
cs.main_billing_country_iso_3_per_deal,

View file

@ -5393,6 +5393,7 @@ models:
- date,
- id_booking,
- service_name
- service_business_type
tests:
- dbt_utils.unique_combination_of_columns:
@ -5400,6 +5401,7 @@ models:
- date
- id_booking
- service_name
- service_business_type
columns:
- name: date
@ -5908,6 +5910,7 @@ models:
- by_new_dash_version
- by_has_upgraded_service
- by_service
- by_service_business_type
- name: dimension_value
data_type: string
@ -6034,6 +6037,7 @@ models:
- date,
- id_booking,
- service_name
- service_business_type
tests:
- dbt_utils.unique_combination_of_columns:
@ -6041,6 +6045,7 @@ models:
- date
- id_booking
- service_name
- service_business_type
columns:
- name: date
@ -6098,6 +6103,7 @@ models:
- "SCREENING"
- "PROTECTION"
- "DEPOSIT_MANAGEMENT"
- "UNKNOWN"
- "UNSET"
- name: new_dash_version
@ -6158,6 +6164,7 @@ models:
- service_name,
- id_booking,
- active_accommodations_per_deal_segmentation.
- service_business_type
tests:
- dbt_utils.unique_combination_of_columns:
@ -6166,6 +6173,7 @@ models:
- id_booking
- service_name
- active_accommodations_per_deal_segmentation
- service_business_type
columns:
- name: start_date
@ -6231,6 +6239,7 @@ models:
- "SCREENING"
- "PROTECTION"
- "DEPOSIT_MANAGEMENT"
- "UNKNOWN"
- "UNSET"
- name: new_dash_version
@ -6290,7 +6299,8 @@ models:
- end_date,
- service_name,
- id_booking,
- active_accommodations_per_deal_segmentation.
- active_accommodations_per_deal_segmentation,
- service_business_type
tests:
- dbt_utils.unique_combination_of_columns:
@ -6299,6 +6309,7 @@ models:
- id_booking
- service_name
- active_accommodations_per_deal_segmentation
- service_business_type
columns:
- name: start_date
@ -6364,6 +6375,7 @@ models:
- "SCREENING"
- "PROTECTION"
- "DEPOSIT_MANAGEMENT"
- "UNKNOWN"
- "UNSET"
- name: new_dash_version