Merged PR 4782: Dashboard, Pricing and Services from Hubspot
# Description Brings 3 new properties from HubSpot - Deals: * Dashboard Type: Old Dash, New Dash or null * Pricing Structure: this contains several possibilities, such as new pricing v1, v2, old pricing (legacy), api pricing, etc. * Partnership Services: what services the client has according to Hubspot. Not the best in terms of quality but better than nothing specially in Old Dash. I also handled a small processing since services were differently separated. This is propagated to intermediate in `int_hubspot__deal`. This is needed to automate the pricing differences for clients in old dash to be moved to new dash. # Checklist - [X] The edited models and dependants run properly with production data. - [X] The edited models are sufficiently documented. **Mostly on intermediate, did not bother to update staging besides the new fields.** - [X] The edited models contain PK tests, and I've ran and passed them. - [X] I have checked for DRY opportunities with other models and docs. - [X] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #28627
This commit is contained in:
parent
5860f5b9f6
commit
fae7572777
4 changed files with 94 additions and 0 deletions
|
|
@ -23,6 +23,9 @@ select
|
||||||
d.amount_of_properties,
|
d.amount_of_properties,
|
||||||
d.last_contacted_date_utc,
|
d.last_contacted_date_utc,
|
||||||
d.amount_times_contacted,
|
d.amount_times_contacted,
|
||||||
|
d.dashboard_type,
|
||||||
|
d.pricing_structure,
|
||||||
|
d.partnership_services,
|
||||||
d.created_at_utc,
|
d.created_at_utc,
|
||||||
d.created_date_utc,
|
d.created_date_utc,
|
||||||
d.updated_at_utc,
|
d.updated_at_utc,
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,31 @@ models:
|
||||||
data_type: integer
|
data_type: integer
|
||||||
description: Amount of times the account has been contacted
|
description: Amount of times the account has been contacted
|
||||||
|
|
||||||
|
- name: dashboard_type
|
||||||
|
data_type: text
|
||||||
|
description: |
|
||||||
|
The type of dashboard that the customer has access to. This applies
|
||||||
|
for platform clients, and can be either Legacy or New.
|
||||||
|
It can be null.
|
||||||
|
|
||||||
|
- name: pricing_structure
|
||||||
|
data_type: text
|
||||||
|
description: |
|
||||||
|
The pricing structure that the customer has. It can be null.
|
||||||
|
|
||||||
|
- name: partnership_services
|
||||||
|
data_type: text
|
||||||
|
description: |
|
||||||
|
The partnership type, i.e., the services that the client has
|
||||||
|
according to hubspot. This field has been processed by applying a
|
||||||
|
standardized separation "|" and an upper case. Be aware that this
|
||||||
|
is not how data is presented in HubSpot.
|
||||||
|
Be aware that this might not capture the full history of services
|
||||||
|
that the client has had in the past, nor necessarily be always
|
||||||
|
up-to-date. For New Dash clients, please refer to backend data
|
||||||
|
for complete accuracy.
|
||||||
|
It can be null.
|
||||||
|
|
||||||
- name: created_at_utc
|
- name: created_at_utc
|
||||||
data_type: timestamp with time zone
|
data_type: timestamp with time zone
|
||||||
description: Timestamp of when the record was created in Hubspot
|
description: Timestamp of when the record was created in Hubspot
|
||||||
|
|
|
||||||
|
|
@ -376,6 +376,48 @@ models:
|
||||||
data_type: jsonb
|
data_type: jsonb
|
||||||
description: ""
|
description: ""
|
||||||
|
|
||||||
|
- name: dashboard_type
|
||||||
|
data_type: text
|
||||||
|
description: |
|
||||||
|
The type of dashboard that the customer has access to. This applies
|
||||||
|
for platform clients, and can be either Legacy or New.
|
||||||
|
It can be null.
|
||||||
|
data_tests:
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- Legacy
|
||||||
|
- New
|
||||||
|
|
||||||
|
- name: pricing_structure
|
||||||
|
data_type: text
|
||||||
|
description: |
|
||||||
|
The pricing structure that the customer has. It can be null.
|
||||||
|
|
||||||
|
- name: partnership_services_raw
|
||||||
|
data_type: text
|
||||||
|
description: |
|
||||||
|
The partnership type, i.e., the services that the client has
|
||||||
|
according to hubspot. This exactly matches the input as is from
|
||||||
|
HubSpot, in the sense that no processing has been applied.
|
||||||
|
Be aware that this might not capture the full history of services
|
||||||
|
that the client has had in the past, nor necessarily be always
|
||||||
|
up-to-date. For New Dash clients, please refer to backend data
|
||||||
|
for complete accuracy.
|
||||||
|
It can be null.
|
||||||
|
|
||||||
|
- name: partnership_services
|
||||||
|
data_type: text
|
||||||
|
description: |
|
||||||
|
The partnership type, i.e., the services that the client has
|
||||||
|
according to hubspot. This field has been processed by applying a
|
||||||
|
standardized separation "|" and an upper case. Be aware that this
|
||||||
|
is not how data is presented in HubSpot.
|
||||||
|
Be aware that this might not capture the full history of services
|
||||||
|
that the client has had in the past, nor necessarily be always
|
||||||
|
up-to-date. For New Dash clients, please refer to backend data
|
||||||
|
for complete accuracy.
|
||||||
|
It can be null.
|
||||||
|
|
||||||
- name: created_at_utc
|
- name: created_at_utc
|
||||||
data_type: timestamp with time zone
|
data_type: timestamp with time zone
|
||||||
description: ""
|
description: ""
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,30 @@ with
|
||||||
cast(
|
cast(
|
||||||
{{ adapter.quote("properties") }} ->> 'free_trial_end_date' as date
|
{{ adapter.quote("properties") }} ->> 'free_trial_end_date' as date
|
||||||
) as free_trial_end_date_utc,
|
) as free_trial_end_date_utc,
|
||||||
|
|
||||||
|
{{ adapter.quote("properties") }} ->> 'dashboard' as dashboard_type,
|
||||||
|
{{ adapter.quote("properties") }}
|
||||||
|
->> 'pricing_structure' as pricing_structure,
|
||||||
|
{{ adapter.quote("properties") }}
|
||||||
|
->> 'partnership_type_' as raw_partnership_services,
|
||||||
|
-- Partnership services are stored as a string with multiple values
|
||||||
|
-- separated by either / or + and these can contain leading or trailing
|
||||||
|
-- spaces. In the following field we apply a standardization to the
|
||||||
|
-- values by replacing the separators with | and converting the values
|
||||||
|
-- to uppercase. The regex applied is:
|
||||||
|
-- \s* → Matches any leading or trailing spaces.
|
||||||
|
-- [+/] → Matches either / or + as separators.
|
||||||
|
-- \s* → Again, ensures spaces around the separator are also replaced.
|
||||||
|
-- 'g' → Applies the replacement globally (to all occurrences in the
|
||||||
|
-- string).
|
||||||
|
upper(
|
||||||
|
regexp_replace(
|
||||||
|
{{ adapter.quote("properties") }} ->> 'partnership_type_',
|
||||||
|
'\s*[+/]\s*',
|
||||||
|
'|',
|
||||||
|
'g'
|
||||||
|
)
|
||||||
|
) as partnership_services,
|
||||||
{{ adapter.quote("properties") }} as properties,
|
{{ adapter.quote("properties") }} as properties,
|
||||||
{{ adapter.quote("createdAt") }} as created_at_utc,
|
{{ adapter.quote("createdAt") }} as created_at_utc,
|
||||||
cast({{ adapter.quote("createdAt") }} as date) as created_date_utc,
|
cast({{ adapter.quote("createdAt") }} as date) as created_date_utc,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue