Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Commit 81e916b

Browse files
Merge pull request #125 from fivetran/merged_deals
Merged deals
2 parents ac7706b + 786bf34 commit 81e916b

15 files changed

Lines changed: 116 additions & 12 deletions

‎.buildkite/scripts/run_models.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dbt run --vars '{hubspot_marketing_enabled: true, hubspot_sales_enabled: false}'
2323
dbt run --vars '{hubspot_marketing_enabled: true, hubspot_contact_merge_audit_enabled: true, hubspot_sales_enabled: false}' --target "$db"
2424
dbt run --vars '{hubspot_marketing_enabled: false, hubspot_sales_enabled: true}' --target "$db"
2525
dbt run --vars '{hubspot_marketing_enabled: false, hubspot_sales_enabled: false}' --target "$db"
26+
dbt run --vars '{hubspot_deal_enabled: true, hubspot_sales_enabled: true, hubspot_merged_deal_enabled: true}' --target "$db"
2627
dbt run --vars '{hubspot__pass_through_all_columns: true, hubspot_service_enabled: true, hubspot_using_all_email_events: false}' --target "$db"
2728
dbt test --target "$db"
2829

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# dbt_hubspot_source v0.14.1
2+
[PR #125](https://github.com/fivetran/dbt_hubspot_source/pull/125) includes the following updates:
3+
4+
## Features
5+
- Adds the `stg_hubspot__merged_deal` model. Downstream, this model is used to remove stale deals and aggregate them to the deal they have been merged into. This is disabled by default as not every user has the `merged_deal` table.
6+
- To enable this model and filter out merged deals downstream, make sure the following is set to `true` in your dbt_project.yml: `hubspot_sales_enabled`, `hubspot_deal_enabled`, and `hubspot_merged_deal_enabled`. See [Step 4 of the README](https://github.com/fivetran/dbt_hubspot_source#step-4-disable-models-for-non-existent-sources) for more details.
7+
18
# dbt_hubspot_source v0.14.0
29
[PR #122](https://github.com/fivetran/dbt_hubspot_source/pull/122) includes the following updates:
310

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ vars:
5555
hubspot_schema: your_schema_name
5656
```
5757
## Step 4: Disable models for non-existent sources
58-
When setting up your Hubspot connection in Fivetran, it is possible that not every table this package expects will be synced. This can occur because you either don't use that functionality in Hubspot or have actively decided to not sync some tables. Therefore we have added enable/disable configs in the `src.yml` to allow you to disable certain sources not present. Downstream models are automatically disabled as well. In order to disable the relevant functionality in the package, you will need to add the relevant variables in your root `dbt_project.yml`. By default, all variables are assumed to be `true` (with exception of `hubspot_service_enabled`, `hubspot_ticket_deal_enabled`, and `hubspot_contact_merge_audit_enabled`). You only need to add variables for the tables different from default:
58+
When setting up your Hubspot connection in Fivetran, it is possible that not every table this package expects will be synced. This can occur because you either don't use that functionality in Hubspot or have actively decided to not sync some tables. Therefore we have added enable/disable configs in the `src.yml` to allow you to disable certain sources not present. Downstream models are automatically disabled as well. In order to disable the relevant functionality in the package, you will need to add the relevant variables in your root `dbt_project.yml`. By default, all variables are assumed to be `true` (with exception of `hubspot_service_enabled`, `hubspot_ticket_deal_enabled`, `hubspot_contact_merge_audit_enabled`, and `hubspot_merged_deal_enabled`). You only need to add variables for the tables different from default:
5959

6060
```yml
6161
# dbt_project.yml
@@ -91,6 +91,7 @@ vars:
9191
hubspot_company_enabled: false
9292
hubspot_company_property_history_enabled: false # Disable the company property history models
9393
hubspot_deal_enabled: false
94+
hubspot_merged_deal_enabled: true # Enables the merged_deal table, which will be used to filter out merged deals from the final deal models. False by default. Note that `hubspot_sales_enabled` and `hubspot_deal_enabled` must not be set to False.
9495
hubspot_deal_company_enabled: false
9596
hubspot_deal_contact_enabled: false
9697
hubspot_deal_property_history_enabled: false # Disables the deal property history tables

‎dbt_project.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'hubspot_source'
2-
version: '0.14.0'
2+
version: '0.14.1'
33
config-version: 2
44
require-dbt-version: [">=1.3.0", "<2.0.0"]
55
models:
@@ -24,6 +24,7 @@ vars:
2424
deal_pipeline: "{{ source('hubspot','deal_pipeline') }}"
2525
deal_pipeline_stage: "{{ source('hubspot','deal_pipeline_stage') }}"
2626
deal_property_history: "{{ source('hubspot','deal_property_history') }}"
27+
merged_deal: "{{ source('hubspot','merged_deal') }}"
2728
email_campaign: "{{ source('hubspot','email_campaign') }}"
2829
email_event: "{{ source('hubspot','email_event') }}"
2930
email_event_bounce: "{{ source('hubspot','email_event_bounce') }}"

‎docs/catalog.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎docs/manifest.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎docs/run_results.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎integration_tests/ci/sample.profiles.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ integration_tests:
1616
pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}"
1717
dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}"
1818
port: 5439
19-
schema: hubspot_source_integration_tests_999
19+
schema: hubspot_source_integration_tests_21
2020
threads: 8
2121
bigquery:
2222
type: bigquery
2323
method: service-account-json
2424
project: 'dbt-package-testing'
25-
schema: hubspot_source_integration_tests_999
25+
schema: hubspot_source_integration_tests_21
2626
threads: 8
2727
keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}"
2828
snowflake:
@@ -33,7 +33,7 @@ integration_tests:
3333
role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}"
3434
database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}"
3535
warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}"
36-
schema: hubspot_source_integration_tests_999
36+
schema: hubspot_source_integration_tests_21
3737
threads: 8
3838
postgres:
3939
type: postgres
@@ -42,13 +42,13 @@ integration_tests:
4242
pass: "{{ env_var('CI_POSTGRES_DBT_PASS') }}"
4343
dbname: "{{ env_var('CI_POSTGRES_DBT_DBNAME') }}"
4444
port: 5432
45-
schema: hubspot_source_integration_tests_999
45+
schema: hubspot_source_integration_tests_21
4646
threads: 8
4747
databricks:
4848
catalog: null
4949
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
5050
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
51-
schema: hubspot_source_integration_tests_999
51+
schema: hubspot_source_integration_tests_21
5252
threads: 8
5353
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
5454
type: databricks

‎integration_tests/dbt_project.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
name: 'hubspot_source_integration_tests'
2-
version: '0.14.0'
2+
version: '0.14.1'
33
profile: 'integration_tests'
44
config-version: 2
55
models:
66
hubspot_source:
77
+schema:
88
vars:
9-
hubspot_schema: hubspot_source_integration_tests_999
9+
hubspot_schema: hubspot_source_integration_tests_21
1010
hubspot_source:
1111
hubspot_service_enabled: true
1212
# hubspot_sales_enabled: true # enable when generating docs
1313
# hubspot_marketing_enabled: true # enable when generating docs
1414
# hubspot_contact_merge_audit_enabled: true # enable when generating docs
1515
# hubspot_using_all_email_events: true # enable when generating docs
16+
# hubspot_merged_deal_enabled: true # enable when generating docs
1617
hubspot_company_property_history_identifier: "company_property_history_data"
1718
hubspot_company_identifier: "company_data"
1819
hubspot_contact_identifier: "contact_data"
@@ -60,6 +61,7 @@ vars:
6061
hubspot_contact_list_identifier: "contact_list_data"
6162
hubspot_email_event_sent_identifier: "email_event_sent_data"
6263
hubspot_email_event_dropped_identifier: "email_event_dropped_data"
64+
hubspot_merged_deal_identifier: "merged_deal_data"
6365

6466
seeds:
6567
hubspot_source_integration_tests:
@@ -174,6 +176,10 @@ seeds:
174176
created: timestamp
175177
obsoleted_by_created: timestamp
176178
sent_by_created: timestamp
179+
merged_deal_data:
180+
+column_types:
181+
deal_id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
182+
merged_deal_id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
177183

178184
dispatch:
179185
- macro_namespace: dbt_utils
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
deal_id,merged_deal_id,_fivetran_synced
2+
9089908390,9014070905,2023-06-22 11:37:07.210000
3+
9089908390,9077310858,2023-06-22 11:37:07.210000
4+
9089908390,9077311778,2023-06-22 11:37:07.210000
5+
9089908390,9014071335,2023-06-22 11:37:07.210000
6+
1364146343,10829010820,2023-06-22 11:37:07.220000
7+
1364146343,10828874842,2023-06-22 11:37:07.220000
8+
1368273549,10829051678,2023-06-22 11:37:07.227000
9+
1368273549,10829028256,2023-06-22 11:37:07.227000
10+
1373595330,10879517198,2023-06-22 11:37:07.227000
11+
1373595330,10828874855,2023-06-22 11:37:07.227000
12+
1006463008,10064581040,2023-06-22 11:37:07.213000
13+
1006463008,9351825260,2023-06-22 11:37:07.213000
14+
1389291069,12351788138,2023-06-28 11:18:32.940000
15+
1389291069,13817889862,2023-06-28 11:18:32.939000

0 commit comments

Comments
 (0)