Merged PR 3207: Cast as dates and timestamps for hubspot deals in staging
# Description Changes data type of dates and timestamps of relevant fields in stg_hubspot__deals # 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. - [NA] I have checked for DRY opportunities with other models and docs. - [NA] 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: #22689
This commit is contained in:
parent
91cac6a441
commit
3faf03c139
2 changed files with 37 additions and 25 deletions
|
|
@ -248,15 +248,15 @@ models:
|
|||
deal.
|
||||
|
||||
- name: contract_signed_date_utc
|
||||
data_type: text
|
||||
data_type: date
|
||||
description: Date in which the contract was signed
|
||||
|
||||
- name: live_date_utc
|
||||
data_type: text
|
||||
data_type: date
|
||||
description: Date in which the account went live
|
||||
|
||||
- name: cancellation_date_utc
|
||||
data_type: text
|
||||
data_type: date
|
||||
description: Date in which an account that was being used was cancelled
|
||||
|
||||
- name: deal_name
|
||||
|
|
@ -293,7 +293,7 @@ models:
|
|||
description: ""
|
||||
|
||||
- name: demo_scheduled_date_utc
|
||||
data_type: text
|
||||
data_type: date
|
||||
description: date at which the demo is scheduled for
|
||||
|
||||
- name: is_demo_completed
|
||||
|
|
@ -305,7 +305,7 @@ models:
|
|||
description: ""
|
||||
|
||||
- name: onboarding_date_utc
|
||||
data_type: text
|
||||
data_type: date
|
||||
description: ""
|
||||
|
||||
- name: onboarding_stage
|
||||
|
|
@ -337,7 +337,7 @@ models:
|
|||
description: ""
|
||||
|
||||
- name: last_nps_survey_date_utc
|
||||
data_type: text
|
||||
data_type: date
|
||||
description: ""
|
||||
|
||||
- name: last_nps_survey_rating
|
||||
|
|
@ -353,7 +353,7 @@ models:
|
|||
description: ""
|
||||
|
||||
- name: last_contacted_at_utc
|
||||
data_type: text
|
||||
data_type: timestamp
|
||||
description: ""
|
||||
|
||||
- name: last_contacted_date_utc
|
||||
|
|
@ -365,11 +365,11 @@ models:
|
|||
description: ""
|
||||
|
||||
- name: free_trial_start_date_utc
|
||||
data_type: text
|
||||
data_type: date
|
||||
description: ""
|
||||
|
||||
- name: free_trial_end_date_utc
|
||||
data_type: text
|
||||
data_type: date
|
||||
description: ""
|
||||
|
||||
- name: properties
|
||||
|
|
|
|||
|
|
@ -10,11 +10,15 @@ with
|
|||
{{ adapter.quote("properties") }}
|
||||
->> 'hubspot_owner_id' as id_hubspot_account_owner,
|
||||
{{ adapter.quote("properties") }}->> 'dedicated_am' as account_manager,
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'contract_signed_date' as contract_signed_date_utc,
|
||||
{{ adapter.quote("properties") }}->> 'live_date' as live_date_utc,
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'cancellation_date' as cancellation_date_utc,
|
||||
cast(
|
||||
{{ adapter.quote("properties") }} ->> 'contract_signed_date' as date
|
||||
) as contract_signed_date_utc,
|
||||
cast(
|
||||
{{ adapter.quote("properties") }}->> 'live_date' as date
|
||||
) as live_date_utc,
|
||||
cast(
|
||||
{{ adapter.quote("properties") }} ->> 'cancellation_date' as date
|
||||
) as cancellation_date_utc,
|
||||
{{ adapter.quote("properties") }}->> 'dealname' as deal_name,
|
||||
{{ adapter.quote("properties") }}->> 'sales_stage' as sales_stage,
|
||||
{{ adapter.quote("properties") }}->> 'dealstage' as id_deal_stage,
|
||||
|
|
@ -26,12 +30,15 @@ with
|
|||
)::integer -- Yes, somehow we managed to input decimals here sometimes, lol
|
||||
as amount_of_properties,
|
||||
{{ adapter.quote("properties") }}->> 'demo_scheduled' as is_demo_scheduled,
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'sales_demo_scheduled' as demo_scheduled_date_utc,
|
||||
cast(
|
||||
{{ adapter.quote("properties") }} ->> 'sales_demo_scheduled' as date
|
||||
) as demo_scheduled_date_utc,
|
||||
{{ adapter.quote("properties") }}->> 'demo_completed' as is_demo_completed,
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'meeting_status__hubspot_' as demo_details,
|
||||
{{ adapter.quote("properties") }}->> 'date_meeting' as onboarding_date_utc,
|
||||
cast(
|
||||
{{ adapter.quote("properties") }}->> 'date_meeting' as date
|
||||
) as onboarding_date_utc,
|
||||
{{ adapter.quote("properties") }}->> 'onboarding_stage' as onboarding_stage,
|
||||
{{ adapter.quote("properties") }}->> 'onboarding_owner' as onboarding_owner,
|
||||
{{ adapter.quote("properties") }}
|
||||
|
|
@ -44,25 +51,30 @@ with
|
|||
->> 'cancellation_category' as cancellation_category,
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'cancellation_details' as cancellation_details,
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'last_nps_survey_date' as last_nps_survey_date_utc,
|
||||
cast(
|
||||
{{ adapter.quote("properties") }} ->> 'last_nps_survey_date' as date
|
||||
) as last_nps_survey_date_utc,
|
||||
({{ adapter.quote("properties") }} ->> 'last_nps_survey_rating')::integer
|
||||
as last_nps_survey_rating,
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'last_nps_survey_comment' as last_nps_survey_comment,
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'customer_nps_sentiment' as customer_nps_sentiment,
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'notes_last_contacted' as last_contacted_at_utc,
|
||||
cast(
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'notes_last_contacted' as timestamp
|
||||
) as last_contacted_at_utc,
|
||||
cast(
|
||||
{{ adapter.quote("properties") }} ->> 'notes_last_contacted' as date
|
||||
) as last_contacted_date_utc,
|
||||
({{ adapter.quote("properties") }} ->> 'num_contacted_notes')::integer
|
||||
as amount_times_contacted,
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'free_trial_start_date' as free_trial_start_date_utc,
|
||||
{{ adapter.quote("properties") }}
|
||||
->> 'free_trial_end_date' as free_trial_end_date_utc,
|
||||
cast(
|
||||
{{ adapter.quote("properties") }} ->> 'free_trial_start_date' as date
|
||||
) as free_trial_start_date_utc,
|
||||
cast(
|
||||
{{ adapter.quote("properties") }} ->> 'free_trial_end_date' as date
|
||||
) as free_trial_end_date_utc,
|
||||
{{ adapter.quote("properties") }} as properties,
|
||||
{{ adapter.quote("createdAt") }} as created_at_utc,
|
||||
cast({{ adapter.quote("createdAt") }} as date) as created_date_utc,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue