From 36290f19b304aae4c399a602dda5b21b1a9231c5 Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Fri, 3 Jan 2025 14:59:47 +0100 Subject: [PATCH] deals consolidation to reporting --- .../reporting/cross/deals_consolidation.sql | 13 ++++ models/reporting/cross/schema.yml | 66 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 models/reporting/cross/deals_consolidation.sql diff --git a/models/reporting/cross/deals_consolidation.sql b/models/reporting/cross/deals_consolidation.sql new file mode 100644 index 0000000..aa6f71a --- /dev/null +++ b/models/reporting/cross/deals_consolidation.sql @@ -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 diff --git a/models/reporting/cross/schema.yml b/models/reporting/cross/schema.yml index 9d95d0d..6f667a4 100644 --- a/models/reporting/cross/schema.yml +++ b/models/reporting/cross/schema.yml @@ -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."