Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding missing fields, casting ticket pipeline IDs, and more specific labels #38

Merged
merged 3 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions models/stg_hubspot__deal.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ with base as (

select *
from {{ ref('stg_hubspot__deal_tmp') }}
where not coalesce(is_deleted, false)
where not coalesce(is_deleted, false)

), macro as (

Expand All @@ -20,6 +20,7 @@ with base as (
), fields as (

select
_fivetran_synced,
deal_id,
deal_pipeline_id,
deal_pipeline_stage_id,
Expand All @@ -35,8 +36,8 @@ with base as (
{{ fivetran_utils.fill_pass_through_columns('hubspot__deal_pass_through_columns') }}

from macro

)

select *
from fields
from fields
12 changes: 6 additions & 6 deletions models/stg_hubspot__ticket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ models:

- name: closed_at
description: The date the ticket was closed.

- name: created_at
description: The date the ticket was created.

- name: first_agent_reply_at
description: the date for the first agent reply on the ticket.

Expand All @@ -109,7 +109,7 @@ models:

- name: ticket_pipeline_stage_id
description: The ID of the ticket's pipeline stage.

- name: ticket_priority
description: The priority of the ticket.

Expand Down Expand Up @@ -138,15 +138,15 @@ models:
description: Used to determine the order in which the stages appear when viewed in HubSpot.
- name: is_closed
description: Boolean indicating if the pipeline stage is closed.
- name: label
- name: pipeline_stage_label
description: The human-readable label for the stage. The label is used when showing the stage in HubSpot.
- name: ticket_pipeline_id
description: The ID of the pipeline.
- name: stage_id
fivetran-joemarkiewicz marked this conversation as resolved.
Show resolved Hide resolved
description: The ID of the pipeline stage.
- name: ticket_state
description: State of the ticket.

- name: stg_hubspot__ticket_pipeline
description: Each record represents a ticket pipeline.
columns:
Expand All @@ -158,7 +158,7 @@ models:
description: Boolean indicating whether the pipeline is active.
- name: display_order
description: Used to determine the order in which the stages appear when viewed in HubSpot.
- name: label
- name: pipeline_label
description: The human-readable label for the stage. The label is used when showing the stage in HubSpot.
- name: object_type_id
description: Reference to the object type.
Expand Down
12 changes: 6 additions & 6 deletions models/stg_hubspot__ticket_pipeline.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

with base as (

select *
select *
from {{ ref('stg_hubspot__ticket_pipeline_tmp') }}

),
Expand All @@ -16,23 +16,23 @@ fields as (
staging_columns=get_ticket_pipeline_columns()
)
}}

from base
),

final as (
select

select
cast(pipeline_id as {{ dbt_utils.type_int() }} ) as ticket_pipeline_id,
_fivetran_deleted,
_fivetran_synced,
active as is_active,
display_order,
label,
label as pipeline_label,
object_type_id
from fields
where not coalesce(_fivetran_deleted, false)
)

select *
select *
from final
14 changes: 7 additions & 7 deletions models/stg_hubspot__ticket_pipeline_stage.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

with base as (

select *
select *
from {{ ref('stg_hubspot__ticket_pipeline_stage_tmp') }}

),
Expand All @@ -16,25 +16,25 @@ fields as (
staging_columns=get_ticket_pipeline_stage_columns()
)
}}

from base
),

final as (
select

select
_fivetran_deleted,
_fivetran_synced,
active as is_active,
display_order,
is_closed,
label,
label as pipeline_stage_label,
cast(pipeline_id as {{ dbt_utils.type_int() }} ) as ticket_pipeline_id,
stage_id as ticket_pipeline_stage_id,
cast(stage_id as {{ dbt_utils.type_int() }} ) as ticket_pipeline_stage_id,
ticket_state
from fields
where not coalesce(_fivetran_deleted, false)
)

select *
select *
from final