-
Notifications
You must be signed in to change notification settings - Fork 3
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
introduce the hubspot engagement table to adjust the joins in int_hub… #13
Changes from 1 commit
c3218b4
5b7920a
51a7484
ed1e205
2db9b0a
57a1017
0829812
938807b
b175bfe
f846b71
c8cd90a
ea23ba5
588d324
dda981c
2768c4d
e484cfd
528f43c
67cb540
67dff0d
08c6597
beb3dc8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
id,type,_fivetran_synced,portal_id | ||
19732910159,CALL,2023-06-08 23:22:38.270000,4703379 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{% macro get_hubspot_engagement_columns() %} | ||
|
||
{% set columns = [ | ||
{"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, | ||
{"name": "active", "datatype": "boolean", "alias": "is_active"}, | ||
{"name": "created_at", "datatype": dbt.type_timestamp(), "alias": "created_timestamp"}, | ||
{"name": "id", "datatype": dbt.type_int()}, | ||
{"name": "owner_id", "datatype": dbt.type_int()}, | ||
{"name": "portal_id", "datatype": dbt.type_int()}, | ||
{"name": "timestamp", "datatype": dbt.type_timestamp(), "alias": "occurred_timestamp"}, | ||
{"name": "type", "datatype": dbt.type_string(), "alias": "engagement_type"} | ||
] %} | ||
|
||
{{ return(columns) }} | ||
|
||
{% endmacro %} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I realized that now that
in order to grab There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update-- have since removed the previous |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,39 @@ models: | |
- name: source_relation | ||
description: The source of the record if the unioning functionality is being used. If it is not this field will be empty. | ||
|
||
- name: stg_rag_hubspot__engagement | ||
description: Each record represents an engagement | ||
columns: | ||
- name: engagement_id | ||
description: The ID of the engagement. | ||
tests: | ||
- not_null | ||
- unique | ||
- name: engagement_type | ||
description: One of NOTE, EMAIL, TASK, MEETING, or CALL, the type of the engagement. | ||
- name: is_active | ||
description: > | ||
Whether the engagement is currently being shown in the UI. | ||
|
||
PLEASE NOTE - This field will only be populated for pre HubSpot v3 API versions. This field is only included to allow for backwards compatibility between HubSpot API versions. This field will be deprecated in the near future. | ||
- name: occurred_timestamp | ||
description: > | ||
A timestamp in representing the time that the engagement should appear in the timeline. | ||
|
||
PLEASE NOTE - This field will only be populated for pre HubSpot v3 API versions. This field is only included to allow for backwards compatibility between HubSpot API versions. This field will be deprecated in the near future. | ||
- name: created_timestamp | ||
description: > | ||
This field marks the call's time of creation and determines where the call sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. | ||
|
||
PLEASE NOTE: This field will only be populated for pre HubSpot v3 API versions. This field is only included to allow for backwards compatibility between HubSpot API versions. This field will be deprecated in the near future. | ||
- name: owner_id | ||
description: > | ||
The ID of the engagement's owner. | ||
|
||
PLEASE NOTE - This field will only be populated for pre HubSpot v3 API versions. This field is only included to allow for backwards compatibility between HubSpot API versions. This field will be deprecated in the near future. | ||
- name: portal_id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't forget to document There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks! updated |
||
description: '{{ doc("portal_id") }}' | ||
|
||
- name: stg_rag_hubspot__engagement_company | ||
description: Each record represents a 'link' between a company and an engagement. | ||
columns: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{{ config(enabled=var('rag__using_hubspot', True)) }} | ||
|
||
with base as ( | ||
|
||
{{ | ||
fivetran_utils.union_data( | ||
table_identifier='engagement', | ||
database_variable='rag_hubspot_database', | ||
schema_variable='rag_hubspot_schema', | ||
default_database=target.database, | ||
default_schema='rag_hubspot', | ||
default_variable='hubspot_engagement', | ||
union_schema_variable='rag_hubspot_union_schemas', | ||
union_database_variable='rag_hubspot_union_databases' | ||
) | ||
}} | ||
), | ||
|
||
fields as ( | ||
|
||
select | ||
{{ | ||
fivetran_utils.fill_staging_columns( | ||
source_columns=adapter.get_columns_in_relation(source('rag_hubspot','engagement')), | ||
staging_columns=get_hubspot_engagement_columns() | ||
) | ||
}} | ||
|
||
{{ fivetran_utils.source_relation( | ||
union_schema_variable='rag_hubspot_union_schemas', | ||
union_database_variable='rag_hubspot_union_databases') | ||
}} | ||
from base | ||
), | ||
|
||
final as ( | ||
|
||
select | ||
id as engagement_id, | ||
created_timestamp, | ||
occurred_timestamp, | ||
owner_id, | ||
source_relation, | ||
portal_id, | ||
is_active | ||
from fields | ||
) | ||
|
||
select * | ||
from final |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason only a subset of seed columns are being run and tested here? Can we add all the relevant columns brought into the staging model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a great point. i initially mocked this up from the internal schema with the new version of tables that i was testing with. I added in the rest of the columns!