Merged PR 5238: Brings additional sales info from hubspot

# Description

Brings additional info from Hubspot Deals regarding onboarding process

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

Related work items: #30249
This commit is contained in:
Oriol Roqué Paniagua 2025-05-16 11:08:17 +00:00
parent ca3fc4add9
commit 43a20a3c22
6 changed files with 114 additions and 1 deletions

View file

@ -399,7 +399,7 @@ models:
description: |
The pricing structure that the customer has. It can be null.
- name: partnership_services_raw
- name: raw_partnership_services
data_type: text
description: |
The partnership type, i.e., the services that the client has
@ -424,6 +424,29 @@ models:
for complete accuracy.
It can be null.
- name: raw_expressed_service_interest
data_type: text
description: |
The services that captured the interest of the potential client
during onboarding calls, for New Dash.
This exactly matches the input as is from HubSpot, in the sense
that no processing has been applied.
Not to be confused with the actual services that host has applied.
For the later, check backend data.
It can be null.
- name: expressed_service_interest
data_type: text
description: |
The services that captured the interest of the potential client
during onboarding calls, for New Dash.
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.
Not to be confused with the actual services that host has applied.
For the later, check backend data.
It can be null.
- name: created_at_utc
data_type: timestamp with time zone
description: ""

View file

@ -100,6 +100,27 @@ with
'g'
)
) as partnership_services,
{{ adapter.quote("properties") }}
->> 'services' as raw_expressed_service_interest,
-- Services (that are of interest in onboarding/sales time) are stored as
-- a string with multiple values separated by ; 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 ; as separator.
-- \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") }} ->> 'services',
'\s*[;]\s*',
'|',
'g'
)
) as expressed_service_interest,
{{ adapter.quote("properties") }} as properties,
{{ adapter.quote("createdAt") }} as created_at_utc,
cast({{ adapter.quote("createdAt") }} as date) as created_date_utc,