-
Notifications
You must be signed in to change notification settings - Fork 32
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
Release/v0.14.0 #122
Release/v0.14.0 #122
Changes from 22 commits
f414338
d445a49
6d98ce8
bf661db
f8ad5d1
b5e018d
3e44728
94b5096
4d01c55
e7f1e11
ea1f00e
0dd05eb
567c352
7d268d6
50fd454
86cfd98
d8ab227
6da136c
032ad0d
028e142
7fca0dc
755f3ff
b63083a
50cbe39
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 |
---|---|---|
|
@@ -104,6 +104,7 @@ vars: | |
hubspot_engagement_note_enabled: false | ||
hubspot_engagement_task_enabled: false | ||
hubspot_owner_enabled: false | ||
hubspot_property_enabled: false # Disables property and property_option tables | ||
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 bump the version in the README 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. |
||
|
||
# Service | ||
hubspot_service_enabled: true # Enables all service models | ||
|
@@ -135,7 +136,7 @@ vars: | |
hubspot__ticket_pass_through_columns: | ||
- name: "property_mmm" | ||
alias: "mmm" | ||
- name: "property_bop" | ||
- name: "property_hs_bop" | ||
alias: "bop" | ||
``` | ||
**Alternatively**, if you would like to simply pass through **all columns** in the above four tables, add the following configuration to your dbt_project.yml. Note that this will override any `hubspot__[table_name]_pass_through_columns` variables. | ||
|
@@ -144,6 +145,34 @@ vars: | |
vars: | ||
hubspot__pass_through_all_columns: true # default is false | ||
``` | ||
|
||
### Adding property label | ||
For `property_hs_*` columns, you can enable the corresponding, human-readable `property_option`.`label` to be included in the staging models. | ||
|
||
#### Important! | ||
- You must have sources `property` and `property_option` enabled to enable labels. By default, these sources are enabled. | ||
- You CANNOT enable labels if using `hubspot__pass_through_all_columns: true`.` | ||
- As you add more label columns, your run time will increase due to the underlying logic requirements. | ||
|
||
To enable labels for a given property, set the property attribute `add_property_label: true`, using the below format. | ||
|
||
```yml | ||
vars: | ||
hubspot__ticket_pass_through_columns: | ||
- name: "property_hs_fieldname" | ||
alias: "fieldname" | ||
add_property_label: true | ||
``` | ||
|
||
Alternatively, you can enable labels for all passthrough properties by using variable `hubspot__enable_all_property_labels: true`, formatted like the below example. | ||
|
||
```yml | ||
vars: | ||
hubspot__enable_all_property_labels: true # cannot use in conjunction with `hubspot__pass_through_all_columns: true` | ||
hubspot__ticket_pass_through_columns: | ||
- name: "property_hs_fieldname1" | ||
- name: "property_hs_fieldname2" | ||
``` | ||
### Including calculated fields | ||
This package also provides the ability to pass calculated fields through to the `company`, `contact`, `deal`, and `ticket` staging models. If you would like to add a calculated field to any of the mentioned staging models, you may configure the respective `hubspot__[table_name]_calculated_fields` variables with the `name` of the field you would like to create, and the `transform_sql` which will be the actual calculation that will make up the calculated field. | ||
```yml | ||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
_fivetran_id,_fivetran_synced,calculated,created_at,description,field_type,group_name,hubspot_defined,hubspot_object,label,name,show_currency_symbol,type,updated_at | ||
+mlGrLvmij8zluyeRByh7DPbXpM=,2023-11-11 08:18:16.519000 UTC,false,2023-05-03 08:51:08.199000 UTC,M0xKTEL9t51+vD5ztRfm+A==,date,fVQYOcf70/KsHU/KFoXQfQ==,,contact,test_pro,test_pro,false,date,2023-05-03 08:51:08.199000 UTC | ||
6fnvV+pkZR3di3USRclW2NZMNTA=,2023-11-11 08:18:15.151000 UTC,false,2019-08-06 02:41:52.364000 UTC,k+VMRhjE/W4QB470Jor1yA==,date,j8mgV9/MYzXvxQKD3c0AHw==,true,deal,Close Date,closedate,,datetime,2023-06-20 22:32:28.368000 UTC | ||
5yTEFwFlLPTKlzXc3PviX5DMdJ4=,2023-11-11 08:18:16.569000 UTC,false,2019-08-06 02:41:09.071000 UTC,nRGOJjIZrs4d0WJLkC15fg==,date,fVQYOcf70/KsHU/KFoXQfQ==,true,contact,Close Date,closedate,,datetime,2022-05-27 20:35:26.640000 UTC | ||
u0bk1tHdJJir2SmRkwo1r22t2PM=,2023-11-11 08:18:15.837000 UTC,false,2019-08-06 02:41:44.665000 UTC,HRIf2XFKVmDQxMzI2w3mcA==,date,XArNQdwSO+DY7119vj+JEw==,true,company,Close Date,closedate,,datetime,2022-05-27 22:49:16.893000 UTC | ||
RTJ5KTwQe/zMYl8uKwNFlOeNWUY=,2023-11-11 08:18:15.792000 UTC,false,2022-11-30 10:52:48.277000 UTC,1B2M2Y8AsgTpgAmY7PhCfg==,date,XArNQdwSO+DY7119vj+JEw==,,company,test_date,test_date,false,date,2022-11-30 10:52:48.277000 UTC | ||
sv5Aa2A1+wJwoKRX4Zfe3CTEHEE=,2023-11-11 08:18:16.575000 UTC,false,2019-08-06 02:41:09.148000 UTC,jjSyQlM9DMhpVol12tp4fg==,date,fVQYOcf70/KsHU/KFoXQfQ==,true,contact,Create Date,createdate,,datetime,2023-05-01 20:02:33.973000 UTC | ||
GjTSotYsbt+HoRY5e6bHRgNJYFI=,2023-11-11 08:18:36.368000 UTC,false,2019-08-06 02:42:48.261000 UTC,nBljQWslMNrEDwXeYmRYyg==,date,0NoL94xOqMRlkFF+GAX6QQ==,true,product,Create Date,createdate,,datetime,2022-05-28 01:26:21.260000 UTC | ||
6iFNLSeY0Fz5DgwskGjrMoW3JIg=,2023-11-11 08:18:13.861000 UTC,false,2019-08-06 02:42:38.781000 UTC,lMRanmvFHjNC0pQdw79H5Q==,date,kdJdJeqzIqBPlKTSRZoyGQ==,true,line_item,Create Date,createdate,,datetime,2022-05-28 01:31:47.067000 UTC | ||
onbRYvHwxXS3NwSP2zaoD+Mv/us=,2023-11-11 08:18:36.567000 UTC,false,2019-08-06 02:43:00.503000 UTC,MD3INB3ab4k2LqaTom0eEA==,date,CfZkcOOMcc/dg5a9ofwkUg==,true,ticket,Create date,createdate,,datetime,2022-08-18 12:55:35.731000 UTC | ||
XhKQ/eq5pqJEB6smEKCPSSyfUH4=,2023-11-11 08:18:15.836000 UTC,false,2019-08-06 02:41:44.631000 UTC,wyvwVnWdqsdNRapzG8Y/RA==,date,XArNQdwSO+DY7119vj+JEw==,true,company,Create Date,createdate,,datetime,2023-05-01 19:33:57.873000 UTC |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
label,property_id,_fivetran_synced,display_order,hidden,value | ||
psScnliy99RZj01H2CO0Bg==,QbL3/uGeJqHy1PwdKiAryA==,2023-07-06 05:18:21.205000 UTC,0,false,Rk7Ftpi8GPQtaS7MlroMGQ== | ||
pSz+WBU1TmUa4LuUa1rgkQ==,QbL3/uGeJqHy1PwdKiAryA==,2023-07-06 05:18:21.205000 UTC,1,false,LA3JfM9iZ4SdcrsahteEeA== | ||
AvzvMEDzIxXmOQHpmJkR2Q==,QbL3/uGeJqHy1PwdKiAryA==,2023-07-06 05:18:21.205000 UTC,2,false,T9S3rtCg0J+FcavCHGDYtw== | ||
82p3OmCpiuf6fXiV9CNUGg==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,54,false,MpeVBohL7jkWOlWD1n2MEQ== | ||
iXyRZw2q18uicoYZGNbgag==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,69,false,ag2ORssJEO3Ix9VleEtdQg== | ||
kNCldBZipThyNGTWrrfg2A==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,61,false,DCbZyLGAXmlPv5n4SfYx9Q== | ||
nXBeZz/aTEAYfzniBd/75g==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,53,false,isnpiTWMqdJGp0MdQexQlA== | ||
Y6UJ4WGHacm+BqSY+9LIWw==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,68,false,NxElfDRGA3UVvLxOm2zBuA== | ||
9/yByDltisVJ/ItQKfpDug==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,58,false,vIGBU9BcEMJOtKde0VQiqw== | ||
olS9+/n99uTy3AIPobhBFQ==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,73,false,0TcZBF4uKrmsLk3qXWb/Hg== | ||
B1Y77Uvfwx7eFghmY0fMnA==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,64,false,/cjAina18SVT3IObiSTw3w== | ||
K9C6Ej/GCH0SeJeYNHAilQ==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,55,false,1m8HK+BNhT7R+gsuVesdxw== | ||
pywmmY+CL/LxU1GOsa6inw==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,63,false,kqfrguMbRr20bZ8iN/xUww== | ||
0ZCS71MB2VSJEfh6gX+MRA==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,59,false,/6WH59+ebbdk/66q3ur5Cw== | ||
o9hmABcYPHTCe5qrVu1lIQ==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,75,false,JUbNYa3Fg/uz4J33ml2QoQ== | ||
du4+7EMJLifwRGQjGBJNbA==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,62,false,oGDrsJou/ln6KJivl+ruWQ== | ||
pTcKx6PCI9FNH+BrqtoqDg==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,60,false,+rN2xb29RGurpWYBfnHC5g== | ||
OHV/B1A6v1fd9MipdPIUKQ==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,70,false,jDwQNnk3/oWaB7pqsOXBLA== | ||
rrQoVUoKzGzFA6Lk2mrmGg==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,76,false,IrC/vHIdyaGW7KTyFPL+LA== | ||
6v8b3yT8/+DhTimhv/UaEg==,stMBaoy9Irlfo81ajZF/Ww==,2023-07-06 05:18:20.949000 UTC,65,false,Z/qUdomTCUc+d/5MgyA10g== |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{% macro add_property_labels(passthrough_var_name, cte_name) %} | ||
fivetran-joemarkiewicz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
select {{ cte_name }}.* | ||
|
||
{% if var(passthrough_var_name, []) != [] and var('hubspot_property_enabled', True) %} | ||
{% set source_name = passthrough_var_name.replace('hubspot__', '').replace('_pass_through_columns', '') %} | ||
{%- set col_list = var(passthrough_var_name) -%} | ||
|
||
{%- for col in col_list -%} -- Create label cols | ||
{%- if col.add_property_label or var('hubspot__enable_all_property_labels', false) -%} | ||
{%- set col_alias = (col.alias | default(col.name)) %} | ||
, {{ col.name }}_option.property_option_label as {{ col_alias }}_label | ||
{% endif -%} | ||
{%- endfor %} | ||
|
||
from {{ cte_name }} | ||
|
||
{% for col in col_list -%} -- Create joins | ||
{%- if col.add_property_label or var('hubspot__enable_all_property_labels', false) -%} | ||
{%- set col_alias = (col.alias | default(col.name)) %} | ||
|
||
left join -- create subset of property and property_options for property in question | ||
(select | ||
property_option.property_option_value, | ||
property_option.property_option_label | ||
from {{ ref('stg_hubspot__property_option') }} as property_option | ||
join {{ ref('stg_hubspot__property') }} as property | ||
on property_option.property_id = property._fivetran_id | ||
where property.property_name = '{{ col.name.replace('property_', '') }}' | ||
and property.hubspot_object = '{{ source_name }}' | ||
) as {{ col.name }}_option | ||
|
||
on cast({{ cte_name }}.{{ col_alias }} as {{ dbt.type_string() }}) | ||
= cast({{ col.name }}_option.property_option_value as {{ dbt.type_string() }}) | ||
|
||
{% endif -%} | ||
{%- endfor %} | ||
|
||
{%- else -%} | ||
from {{ cte_name }} | ||
|
||
{%- endif -%} | ||
{% endmacro %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{% macro get_property_columns() %} | ||
|
||
{% set columns = [ | ||
{"name": "_fivetran_id", "datatype": dbt.type_string()}, | ||
{"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, | ||
{"name": "calculated", "datatype": dbt.type_boolean()}, | ||
{"name": "created_at", "datatype": dbt.type_timestamp()}, | ||
{"name": "description", "datatype": dbt.type_string()}, | ||
{"name": "field_type", "datatype": dbt.type_string()}, | ||
{"name": "group_name", "datatype": dbt.type_string()}, | ||
{"name": "hubspot_defined", "datatype": dbt.type_boolean()}, | ||
{"name": "hubspot_object", "datatype": dbt.type_string()}, | ||
{"name": "label", "datatype": dbt.type_string()}, | ||
{"name": "name", "datatype": dbt.type_string()}, | ||
{"name": "show_currency_symbol", "datatype": dbt.type_boolean()}, | ||
{"name": "type", "datatype": dbt.type_string()}, | ||
{"name": "updated_at", "datatype": dbt.type_timestamp()} | ||
] %} | ||
|
||
{{ return(columns) }} | ||
|
||
{% endmacro %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% macro get_property_option_columns() %} | ||
|
||
{% set columns = [ | ||
{"name": "label", "datatype": dbt.type_string()}, | ||
{"name": "property_id", "datatype": dbt.type_string()}, | ||
{"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, | ||
{"name": "display_order", "datatype": dbt.type_int()}, | ||
{"name": "hidden", "datatype": dbt.type_boolean()}, | ||
{"name": "value", "datatype": dbt.type_string()} | ||
] %} | ||
|
||
{{ return(columns) }} | ||
|
||
{% endmacro %} |
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 this really a breaking change? This seems more like a feature. Thoughts?
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.
I went back and forth on this. I decided to make it breaking since we are adding
property
andproperty_option
, which everyone may not have. I was also worried that since I was adding this macro with joins to the source that it might cause unforeseen issues.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.
Ahh okay I see what you mean. I would actually request this be folded into the feature updates and then provide a blurb that leveraging this new feature you will require the property tables and if you do not have them then you will need to disable the tables and you cannot leverage this feature.
When I see breaking change I think something from the previous build is now different and can change my downstream transformations. Reading through this I don't get the impression this is a 🚨 Breaking 🚨 change, but rather a feature that will result in a 0.X.0 version bump.