Skip to content

Commit

Permalink
Merge pull request #140 from fivetran/bugfix/integer_overflow
Browse files Browse the repository at this point in the history
cast as int bug
  • Loading branch information
fivetran-reneeli authored Apr 16, 2024
2 parents bf9aec2 + f06b65e commit 3c56c7f
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 25 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

target/
dbt_modules/
logs/

dbt_packages/
env/
dbt_packages/
.DS_Store
package-lock.yml
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# dbt_hubspot v0.17.1
[PR #140](https://github.com/fivetran/dbt_hubspot/pull/140) includes the following updates:

## Bug Fixes
- Included explicit datatype casts to `{{ dbt.type_string() }}` within the join of `contact_merge_audit.vid_to_merge` to `contacts.contact_id` in the `int_hubspot__contact_merge_adjust` model.
- This update was required to address a bug where the IDs in the join would overflow to bigint or be interpreted as strings. This change ensures the join fields have matching datatypes.

# dbt_hubspot v0.17.0
[PR #137](https://github.com/fivetran/dbt_hubspot/pull/137) includes the following updates:

Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'hubspot'
version: '0.17.0'
version: '0.17.1'

config-version: 2
require-dbt-version: [">=1.3.0", "<2.0.0"]
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/run_results.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion integration_tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ dbt_modules/
logs/
.DS_Store
dbt_packages/
env/
env/
package-lock.yml
10 changes: 5 additions & 5 deletions integration_tests/ci/sample.profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ integration_tests:
pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}"
dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}"
port: 5439
schema: hubspot_integration_tests_11
schema: hubspot_integration_tests_55
threads: 8
bigquery:
type: bigquery
method: service-account-json
project: 'dbt-package-testing'
schema: hubspot_integration_tests_11
schema: hubspot_integration_tests_55
threads: 8
keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}"
snowflake:
Expand All @@ -33,7 +33,7 @@ integration_tests:
role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}"
database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}"
warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}"
schema: hubspot_integration_tests_11
schema: hubspot_integration_tests_55
threads: 8
postgres:
type: postgres
Expand All @@ -42,13 +42,13 @@ integration_tests:
pass: "{{ env_var('CI_POSTGRES_DBT_PASS') }}"
dbname: "{{ env_var('CI_POSTGRES_DBT_DBNAME') }}"
port: 5432
schema: hubspot_integration_tests_11
schema: hubspot_integration_tests_55
threads: 8
databricks:
catalog: "{{ env_var('CI_DATABRICKS_DBT_CATALOG') }}"
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
schema: hubspot_integration_tests_11
schema: hubspot_integration_tests_55
threads: 8
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
type: databricks
17 changes: 10 additions & 7 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: 'hubspot_integration_tests'
version: '0.17.0'
version: '0.17.1'

profile: 'integration_tests'
config-version: 2
vars:
hubspot_schema: hubspot_integration_tests_11
hubspot_schema: hubspot_integration_tests_55
hubspot_source:
hubspot_service_enabled: true
hubspot_sales_enabled: true # enable when generating docs
hubspot_marketing_enabled: true # enable when generating docs
hubspot_contact_merge_audit_enabled: true # enable when generating docs
hubspot_using_all_email_events: true # enable when generating docs
hubspot_merged_deal_enabled: true # enable when generating docs
# hubspot_sales_enabled: true # enable when generating docs
# hubspot_marketing_enabled: true # enable when generating docs
# hubspot_contact_merge_audit_enabled: true # enable when generating docs
# hubspot_using_all_email_events: true # enable when generating docs
# hubspot_merged_deal_enabled: true # enable when generating docs
hubspot_company_property_history_identifier: "company_property_history_data"
hubspot_company_identifier: "company_data"
hubspot_contact_identifier: "contact_data"
Expand Down Expand Up @@ -64,6 +64,9 @@ vars:
seeds:
hubspot_integration_tests:
+quote_columns: "{{ true if target.type == 'redshift' else false }}"
contact_merge_audit_data:
+column_types:
vid_to_merge: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
owner_data:
+column_types:
owner_id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ dbt-redshift>=1.3.0,<2.0.0
dbt-postgres>=1.3.0,<2.0.0
dbt-spark>=1.3.0,<2.0.0
dbt-spark[PyHive]>=1.3.0,<2.0.0
dbt-databricks>=1.3.0,<2.0.0
dbt-databricks>=1.3.0,<1.7.13
2 changes: 1 addition & 1 deletion integration_tests/seeds/contact_merge_audit_data.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
canonical_vid,contact_id,vid_to_merge,_fivetran_synced,entity_id,first_name,last_name,num_properties_moved,timestamp,user_id
5555,5555,11111,2020-12-30 11:20:31,json,,,2,2019-10-08 15:50:57,
5555,5555,2147483648,2020-12-30 11:20:31,json,,,2,2019-10-08 15:50:57,
4444,4444,7777,2021-01-09 11:16:00,json,,,2,2019-09-03 15:39:29,
3333,3333,8888,2020-12-29 11:16:02,json,,,2,2019-11-20 20:17:59,
2222,2222,9999,2020-12-30 11:16:58,json,,,2,2019-12-10 18:14:34,
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ with contacts as (
from contacts

left join contact_merge_audit
on contacts.contact_id = cast(contact_merge_audit.vid_to_merge as {{ dbt.type_int() }})
on cast(contacts.contact_id as {{ dbt.type_string() }}) = cast(contact_merge_audit.vid_to_merge as {{ dbt.type_string() }})

where contact_merge_audit.vid_to_merge is null
)
Expand Down

0 comments on commit 3c56c7f

Please sign in to comment.