Merged PR 4698: Added business scope to models
# Description Added business scope to models `monthly_aggregated_metrics_history_by_deal` # 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. Added business scope to models Related work items: #28501
This commit is contained in:
commit
b518c536f2
8 changed files with 84 additions and 0 deletions
|
|
@ -90,6 +90,21 @@ select
|
||||||
dda.active_accommodations_per_deal_segmentation, 'UNSET'
|
dda.active_accommodations_per_deal_segmentation, 'UNSET'
|
||||||
) as active_accommodations_per_deal_segmentation,
|
) as active_accommodations_per_deal_segmentation,
|
||||||
ikdd.main_billing_country_iso_3_per_deal,
|
ikdd.main_billing_country_iso_3_per_deal,
|
||||||
|
-- DEAL BUSINESS SCOPE
|
||||||
|
case
|
||||||
|
when ikdd.client_type = 'API'
|
||||||
|
then 'API'
|
||||||
|
when ikdd.client_type = 'PLATFORM'
|
||||||
|
then
|
||||||
|
case
|
||||||
|
when
|
||||||
|
ikdd.id_deal is not null
|
||||||
|
and d.date >= ikdd.min_user_in_new_dash_since_date_utc
|
||||||
|
then 'New Dash'
|
||||||
|
else 'Old Dash'
|
||||||
|
end
|
||||||
|
else 'UNSET'
|
||||||
|
end as business_scope,
|
||||||
|
|
||||||
-- DEAL LIFECYCLE --
|
-- DEAL LIFECYCLE --
|
||||||
daily_deal_lifecycle.deal_lifecycle_state,
|
daily_deal_lifecycle.deal_lifecycle_state,
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ with
|
||||||
date,
|
date,
|
||||||
id_deal,
|
id_deal,
|
||||||
client_type,
|
client_type,
|
||||||
|
business_scope,
|
||||||
main_deal_name,
|
main_deal_name,
|
||||||
has_active_pms,
|
has_active_pms,
|
||||||
active_pms_list,
|
active_pms_list,
|
||||||
|
|
@ -128,6 +129,7 @@ with
|
||||||
date,
|
date,
|
||||||
id_deal,
|
id_deal,
|
||||||
client_type,
|
client_type,
|
||||||
|
business_scope,
|
||||||
main_deal_name,
|
main_deal_name,
|
||||||
has_active_pms,
|
has_active_pms,
|
||||||
active_pms_list,
|
active_pms_list,
|
||||||
|
|
@ -228,6 +230,7 @@ with
|
||||||
date,
|
date,
|
||||||
id_deal,
|
id_deal,
|
||||||
client_type,
|
client_type,
|
||||||
|
business_scope,
|
||||||
main_deal_name,
|
main_deal_name,
|
||||||
has_active_pms,
|
has_active_pms,
|
||||||
active_pms_list,
|
active_pms_list,
|
||||||
|
|
@ -328,6 +331,7 @@ with
|
||||||
date,
|
date,
|
||||||
id_deal,
|
id_deal,
|
||||||
client_type,
|
client_type,
|
||||||
|
business_scope,
|
||||||
main_deal_name,
|
main_deal_name,
|
||||||
has_active_pms,
|
has_active_pms,
|
||||||
active_pms_list,
|
active_pms_list,
|
||||||
|
|
@ -428,6 +432,7 @@ with
|
||||||
date,
|
date,
|
||||||
id_deal,
|
id_deal,
|
||||||
client_type,
|
client_type,
|
||||||
|
business_scope,
|
||||||
main_deal_name,
|
main_deal_name,
|
||||||
has_active_pms,
|
has_active_pms,
|
||||||
active_pms_list,
|
active_pms_list,
|
||||||
|
|
@ -551,6 +556,7 @@ select
|
||||||
|
|
||||||
-- Deal attributes
|
-- Deal attributes
|
||||||
mabd.client_type,
|
mabd.client_type,
|
||||||
|
mabd.business_scope,
|
||||||
mabd.main_deal_name,
|
mabd.main_deal_name,
|
||||||
mabd.has_active_pms,
|
mabd.has_active_pms,
|
||||||
mabd.active_pms_list,
|
mabd.active_pms_list,
|
||||||
|
|
|
||||||
|
|
@ -365,6 +365,19 @@ models:
|
||||||
- PLATFORM
|
- PLATFORM
|
||||||
- API
|
- API
|
||||||
|
|
||||||
|
- name: business_scope
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Business scope identifying the metric source.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "Old Dash"
|
||||||
|
- "New Dash"
|
||||||
|
- "API"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
- name: main_deal_name
|
- name: main_deal_name
|
||||||
data_type: string
|
data_type: string
|
||||||
description: |
|
description: |
|
||||||
|
|
@ -1548,6 +1561,19 @@ models:
|
||||||
- PLATFORM
|
- PLATFORM
|
||||||
- API
|
- API
|
||||||
|
|
||||||
|
- name: business_scope
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Business scope identifying the metric source.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "Old Dash"
|
||||||
|
- "New Dash"
|
||||||
|
- "API"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
- name: metric_from_date
|
- name: metric_from_date
|
||||||
data_type: date
|
data_type: date
|
||||||
description: |
|
description: |
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
{{ config(materialized="table", unique_key="id_deal") }}
|
{{ config(materialized="table", unique_key="id_deal") }}
|
||||||
with
|
with
|
||||||
|
int_core__new_dash_deal_since_date as (
|
||||||
|
select * from {{ ref("int_core__new_dash_deal_since_date") }}
|
||||||
|
),
|
||||||
hubspot_deals as (
|
hubspot_deals as (
|
||||||
select
|
select
|
||||||
id_deal,
|
id_deal,
|
||||||
|
|
@ -70,7 +73,9 @@ select
|
||||||
cd.main_billing_country_iso_3_per_deal,
|
cd.main_billing_country_iso_3_per_deal,
|
||||||
cd.effective_deal_start_date_utc,
|
cd.effective_deal_start_date_utc,
|
||||||
cd.effective_deal_start_month,
|
cd.effective_deal_start_month,
|
||||||
|
icnddsd.min_user_in_new_dash_since_date_utc,
|
||||||
cd.hubspot_deal_cancellation_date_utc,
|
cd.hubspot_deal_cancellation_date_utc,
|
||||||
cd.hubspot_deal_cancellation_month,
|
cd.hubspot_deal_cancellation_month,
|
||||||
cd.hubspot_listing_segmentation
|
cd.hubspot_listing_segmentation
|
||||||
from combined_deals cd
|
from combined_deals cd
|
||||||
|
left join int_core__new_dash_deal_since_date icnddsd on cd.id_deal = icnddsd.id_deal
|
||||||
|
|
|
||||||
|
|
@ -496,6 +496,10 @@ models:
|
||||||
to the month.
|
to the month.
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
- name: min_user_in_new_dash_since_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
The date when the first user host appeared in New Dash for this deal.
|
||||||
- name: hubspot_deal_cancellation_date_utc
|
- name: hubspot_deal_cancellation_date_utc
|
||||||
data_type: date
|
data_type: date
|
||||||
description: |
|
description: |
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ select
|
||||||
date as date,
|
date as date,
|
||||||
id_deal as id_deal,
|
id_deal as id_deal,
|
||||||
client_type as client_type,
|
client_type as client_type,
|
||||||
|
business_scope as business_scope,
|
||||||
main_deal_name as main_deal_name,
|
main_deal_name as main_deal_name,
|
||||||
main_billing_country_iso_3_per_deal as main_billing_country_iso_3_per_deal,
|
main_billing_country_iso_3_per_deal as main_billing_country_iso_3_per_deal,
|
||||||
deal_lifecycle_state as deal_lifecycle_state,
|
deal_lifecycle_state as deal_lifecycle_state,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ select
|
||||||
main_deal_name as main_deal_name,
|
main_deal_name as main_deal_name,
|
||||||
has_active_pms as has_active_pms,
|
has_active_pms as has_active_pms,
|
||||||
client_type as client_type,
|
client_type as client_type,
|
||||||
|
business_scope as business_scope,
|
||||||
active_pms_list as active_pms_list,
|
active_pms_list as active_pms_list,
|
||||||
active_accommodations_per_deal_segmentation
|
active_accommodations_per_deal_segmentation
|
||||||
as active_accommodations_per_deal_segmentation,
|
as active_accommodations_per_deal_segmentation,
|
||||||
|
|
|
||||||
|
|
@ -505,6 +505,19 @@ models:
|
||||||
- PLATFORM
|
- PLATFORM
|
||||||
- API
|
- API
|
||||||
|
|
||||||
|
- name: business_scope
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Business scope identifying the metric source.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "Old Dash"
|
||||||
|
- "New Dash"
|
||||||
|
- "API"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
- name: main_deal_name
|
- name: main_deal_name
|
||||||
data_type: string
|
data_type: string
|
||||||
description: |
|
description: |
|
||||||
|
|
@ -1524,6 +1537,19 @@ models:
|
||||||
- PLATFORM
|
- PLATFORM
|
||||||
- API
|
- API
|
||||||
|
|
||||||
|
- name: business_scope
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Business scope identifying the metric source.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "Old Dash"
|
||||||
|
- "New Dash"
|
||||||
|
- "API"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
- name: metric_from_date
|
- name: metric_from_date
|
||||||
data_type: date
|
data_type: date
|
||||||
description: |
|
description: |
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue