Merged PR 3937: deals consolidation to reporting

# Description

Deals consolidation to reporting

# 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.

deals consolidation to reporting

Related work items: #25827
This commit is contained in:
Joaquin Ossa 2025-01-03 14:49:38 +00:00
commit 6d261e281e
2 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,13 @@
with int_deals_consolidation as (select * from {{ ref("int_deals_consolidation") }})
select
id_deal as id_deal,
core_company_name as core_company_name,
core_company_name_count as core_company_name_count,
hubspot_deal_name as hubspot_deal_name,
hubspot_deal_name_count as hubspot_deal_name_count,
xero_contact_name as xero_contact_name,
xero_contact_name_count as xero_contact_name_count,
is_deal_in_core as is_deal_in_core,
is_deal_in_hubspot as is_deal_in_hubspot,
is_deal_in_xero as is_deal_in_xero
from int_deals_consolidation

View file

@ -211,3 +211,69 @@ models:
- name: created_date_utc
data_type: date
description: "Date of creation of the verification in the system"
- name: deals_consolidation
description: |
"This table contains all deal ids from different sources used in Superhog.
It contains the source (Hubspot, Xero or Core), the id_deal and the name"
columns:
- name: id_deal
data_type: character varying
description: "Unique ID for this deal."
tests:
- unique
- not_null
- name: core_company_name
data_type: character varying
description: "Company name of the deal as shown in Core."
- name: core_company_name_count
data_type: integer
description: "Count of distinct names the deal has in Core.
It might be the case that a deal has ony NULL value for a name,
so the count will be 0"
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: hubspot_deal_name
data_type: character varying
description: "Name of the deal as shown in Hubspot."
- name: hubspot_deal_name_count
data_type: integer
description: "Count of distinct names the deal has in Hubspot.
It might be the case that a deal has ony NULL value for a name,
so the count will be 0"
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: xero_contact_name
data_type: character varying
description: "Contact name of the deal as shown in Xero."
- name: xero_contact_name_count
data_type: integer
description: "Count of distinct names the deal has in Xero.
It might be the case that a deal has ony NULL value for a name,
so the count will be 0"
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: is_deal_in_core
data_type: boolean
description: "Flag to indicate if the deal is in Core."
- name: is_deal_in_hubspot
data_type: boolean
description: "Flag to indicate if the deal is in Hubspot."
- name: is_deal_in_xero
data_type: boolean
description: "Flag to indicate if the deal is in Xero."