-
Notifications
You must be signed in to change notification settings - Fork 39
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
cast as int bug #140
cast as int bug #140
Conversation
regen docs once approved |
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.
@fivetran-reneeli thanks for applying these changes. I just have a few comments that I feel should be applied. In addition, would you be able to provide more details to your validation efforts? I see you listed the steps you took, however, would you also be able to share screenshots (if appropriate to share publicly then you may include them in the PR, if not you can share in the height ticket) of your validation steps. This way I can see directly the steps taken and the expected failures and successes. Finally, it looks like buildkite is still failing. It may just need a schema refresh.
Lastly, were you able to test these changes on the customers data who initially opened this bug report? I would want to get confirmation that these solve the initial error directly. Thanks!
CHANGELOG.md
Outdated
- In `int_hubspot__contact_merge_adjust`, updates casting of `vid_to_merge` as `{{ dbt.type_int() }}` to `{{ dbt.type_string() }}` in the join of `contact_merge_audit` to `contacts`. Previously, casting only to `int` caused model failures resulting from integer fields that exceeded the range allowed in certain warehouses. In addition, for the case where the `contact_merge_audit` table is not present, the parsed `calculated_merged_vids` from the contact table are outputted as strings, therefore requiring the titular datatype cast in the join. | ||
|
||
For context, the [Nov 2022 release of the Hubspot connector](https://fivetran.com/docs/connectors/applications/hubspot/changelog#november2022) should not have the `contact_merge_audit` table as that was deprecated in place of storing `property_hs_calculated_merged_vids` in the `contact` table. |
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.
This feels quite lengthy and crowded. I believe we can make this a bit more streamlined and direct. What are your thoughts on the following?
- In `int_hubspot__contact_merge_adjust`, updates casting of `vid_to_merge` as `{{ dbt.type_int() }}` to `{{ dbt.type_string() }}` in the join of `contact_merge_audit` to `contacts`. Previously, casting only to `int` caused model failures resulting from integer fields that exceeded the range allowed in certain warehouses. In addition, for the case where the `contact_merge_audit` table is not present, the parsed `calculated_merged_vids` from the contact table are outputted as strings, therefore requiring the titular datatype cast in the join. | |
For context, the [Nov 2022 release of the Hubspot connector](https://fivetran.com/docs/connectors/applications/hubspot/changelog#november2022) should not have the `contact_merge_audit` table as that was deprecated in place of storing `property_hs_calculated_merged_vids` in the `contact` table. | |
- 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. |
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.
looks good! I would still add that snippet referring to the nov 2022 api update, so that people reading this who don't have contact_merge_audit table will know it's still relevant, but I'm going to update that part to make it more clear.
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.
update-- never mind, will not mention the nov 2022 api update since it's been a while since then
Co-authored-by: Joe Markiewicz <[email protected]>
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.
@fivetran-reneeli thanks for working on these updates and adding more validation details to the PR description. Ultimately this PR is good to go! I do have a small comment in the CHANGELOG and reminder to uncomment the variables in the integration_tests/dbt_project.yml. Once that is updated this is good for release review.
# 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 |
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.
These should be commented back in to properly test during integration tests
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.
@fivetran-joemarkiewicz I just had these enabled to generate docs, but commented out otherwise since I assumed they weren't needed for tests as they're explicitly configured in the run script?
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.
Got it, I was wondering why they were not commented out previously. This looks good then, thanks!
PR Overview
This PR will address the following Issue/Feature:
#139
This PR will result in the following new package version: v0.17.1
Please detail what change(s) this PR introduces and any additional information that should be known during the review of this PR:
vid_to_merge
as{{ dbt.type_int() }}
to{{ dbt.type_string() }}
. Casting only toint
caused model failures resulting from integer fields that exceeded the range allowed in certain warehouses. In addition, for the case where thecontact_merge_audit
table is not present, the parsedcalculated_merged_vids
from the contact table are outputted as strings, therefore requiring the titular datatype cast in the join.PR Checklist
Basic Validation
Please acknowledge that you have successfully performed the following commands locally:
Before marking this PR as "ready for review" the following have been applied:
Detailed Validation
Please acknowledge that the following validation checks have been performed prior to marking this PR as "ready for review":
Testing where
contact_merge_audit
existsI first recreated the issue by changing a value of
vid_to_merge
in thecontact_audit_merge
table to something larger than 2147483647, then running. Running against prod, as expected I got a size error (Value out of range for 4 bytes.)Then in this branch, I updated the cast to use string. The model ran successfully.
Updating to bigint was also successful.
We ultimately ended choosing to cast as string for the added reason where in the case where the
contact_merge_audit
table is not present, the parsedcalculated_merged_vids
from the contact table are outputted as strings, therefore requiring the titular datatype cast in the join. Therefore both join keys are going to be cast as stringsTesting for when
contact_merge_audit
doesn't existhubspot_contact_merge_audit_enabled
as the default is false.Standard Updates
Please acknowledge that your PR contains the following standard updates:
dbt Docs
Please acknowledge that after the above were all completed the below were applied to your branch:
If you had to summarize this PR in an emoji, which would it be?
💃