Addressed comments
This commit is contained in:
parent
8898a2d150
commit
e007b85d87
2 changed files with 11 additions and 11 deletions
|
|
@ -1948,13 +1948,13 @@ models:
|
|||
- name: has_active_pms
|
||||
data_type: boolean
|
||||
description: |
|
||||
Does the deal have an active associated PMS.
|
||||
Does the host have an active associated PMS.
|
||||
data_tests:
|
||||
- not_null
|
||||
- name: active_pms_list
|
||||
data_type: string
|
||||
description: |
|
||||
Name of the active PMS associated with the deal. It can have more than
|
||||
Name of the active PMS associated with the host. It can have more than
|
||||
one PMS associated with it. It can be null if it doesn't have any PMS associated.
|
||||
- name: main_billing_country_name_per_deal
|
||||
data_type: string
|
||||
|
|
@ -2513,14 +2513,14 @@ models:
|
|||
- name: has_active_pms
|
||||
data_type: boolean
|
||||
description: |
|
||||
Does the deal have an active associated PMS.
|
||||
Does the host have an active associated PMS.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: active_pms_list
|
||||
data_type: string
|
||||
description: |
|
||||
Name of the active PMS associated with the deal. It can have more than
|
||||
Name of the active PMS associated with the host. It can have more than
|
||||
one PMS associated with it. It can be null if it doesn't have any PMS associated.
|
||||
|
||||
- name: company_name
|
||||
|
|
|
|||
|
|
@ -26,18 +26,19 @@ with
|
|||
select
|
||||
id_deal,
|
||||
main_deal_name,
|
||||
has_active_pms,
|
||||
active_pms_list,
|
||||
first_created_date_utc as deal_start_date,
|
||||
date_trunc('month', first_created_date_utc) as deal_start_month,
|
||||
main_billing_country_iso_3_per_deal
|
||||
from {{ ref("int_core__deal") }}
|
||||
),
|
||||
integrations_per_deal as (
|
||||
select id_deal, has_active_pms, active_pms_list from {{ ref("int_core__deal") }}
|
||||
),
|
||||
combined_deals as (
|
||||
select
|
||||
coalesce(hd.id_deal, cd.id_deal) as id_deal,
|
||||
coalesce(hd.main_deal_name, cd.main_deal_name) as main_deal_name,
|
||||
coalesce(cd.has_active_pms, false) as has_active_pms,
|
||||
cd.active_pms_list,
|
||||
cd.main_billing_country_iso_3_per_deal,
|
||||
min(
|
||||
coalesce(hd.deal_start_date, cd.deal_start_date)
|
||||
|
|
@ -50,13 +51,13 @@ with
|
|||
min(hd.hubspot_listing_segmentation) as hubspot_listing_segmentation
|
||||
from hubspot_deals hd
|
||||
full outer join core_deals cd on hd.id_deal = cd.id_deal
|
||||
group by 1, 2, 3
|
||||
group by 1, 2, 3, 4, 5
|
||||
)
|
||||
select
|
||||
cd.id_deal,
|
||||
cd.main_deal_name,
|
||||
coalesce(ipd.has_active_pms, false) as has_active_pms,
|
||||
ipd.active_pms_list,
|
||||
cd.has_active_pms,
|
||||
cd.active_pms_list,
|
||||
cd.main_billing_country_iso_3_per_deal,
|
||||
cd.effective_deal_start_date_utc,
|
||||
cd.effective_deal_start_month,
|
||||
|
|
@ -64,4 +65,3 @@ select
|
|||
cd.hubspot_deal_cancellation_month,
|
||||
cd.hubspot_listing_segmentation
|
||||
from combined_deals cd
|
||||
left join integrations_per_deal ipd on cd.id_deal = ipd.id_deal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue