fivetran / dbt_hubspot_source

Data models for Hubspot built using dbt.
https://fivetran.github.io/dbt_hubspot_source/
Apache License 2.0
30 stars 32 forks source link

Ticket models are not created #76

Closed moseleyi closed 1 year ago

moseleyi commented 1 year ago

Is there an existing issue for this?

Describe the issue

Company, Deal, Email, Engagement, and Owner staging tables are created fine but the Ticket tables are missing. Do they have to be enabled specifically?

Relevant error log or model output

No response

Expected behavior

Stg views defined in dbt_project.yml are available:

    ticket_company: "{{ source('hubspot','ticket_company') }}"
    ticket_contact: "{{ source('hubspot','ticket_contact') }}"
    ticket_deal: "{{ source('hubspot','ticket_deal') }}"
    ticket_engagement: "{{ source('hubspot','ticket_engagement') }}"
    ticket_pipeline: "{{ source('hubspot','ticket_pipeline') }}"
    ticket_pipeline_stage: "{{ source('hubspot','ticket_pipeline_stage') }}"
    ticket_property_history: "{{ source('hubspot','ticket_property_history') }}"
    ticket: "{{ source('hubspot','ticket') }}"

dbt Project configurations

vars: hubspot_source: hubspot_database: FIVETRAN hubspot_schema: hubspot hubspot_email_event_print_enabled: false hubspot_email_event_forward_enabled: false hubspot_contact_merge_audit_enabled: true hubspot__pass_through_all_columns: true

Package versions

packages:

What database are you using dbt with?

snowflake

dbt Version

1.2

Additional Context

No response

Are you willing to open a PR to help address this issue?

fivetran-joemarkiewicz commented 1 year ago

Hi @moseleyi thanks so much for opening this issue!

Luckily there is a quick fix for you to get the ticket models created in your next run. You can simple set the hubspot_service_enabled variable to be true (it is false by default).

vars:
   hubspot_service_enabled: true

While this is a quick fix, we did not do a good job documenting in the README that this variable is used for the ticket models. I noticed you are open to creating a PR! This would be a great documentation update PR if you are willing to tackle it. I would recommend we simply adjust our wording in the Disable Models section to explicitly state that this variable is used for the ticket models. Similarly, we would want to make the same adjustment in our dbt_hubspot package to be consistent with the documentation.

Let me know if you would be interested in addressing this PR. Otherwise, our team will be able to address this in our next sprint. Additionally, please let me know if setting the variable fixes your initial problem, if not we will want to look more into that 😄

moseleyi commented 1 year ago

Hi,

I added hubspot_service_enabled: true like you suggested but now I'm getting this error:

06:42:07  Database Error in model stg_hubspot__ticket_deal_tmp (models/tmp/stg_hubspot__ticket_deal_tmp.sql)
06:42:07    002003 (42S02): SQL compilation error:
06:42:07    Object 'FIVETRAN.HUBSPOT.TICKET_DEAL' does not exist or not authorized.
06:42:07    compiled SQL at target/run/hubspot_source/models/tmp/stg_hubspot__ticket_deal_tmp.sql

I'm guessing it's because we never used the connection between tickets and deals but it shouldn't stop the package from creating basic ticket models, that are independent of Deals, should it?

fivetran-jamie commented 1 year ago

Hi @moseleyi -- can you confirm that the ticket_deal table doesn't exist in your warehouse? if that's indeed the case, I am thinking we should introduce a hubspot_ticket_deal_enabled variable to disable its corresponding models

moseleyi commented 1 year ago

Fivetran does have it selected but the table isn't built, which I'm guessing suggests that it hasn't been used in Hubspot. Probably because when we used tickets, we never used to join them with Deals. image

fivetran-jamie commented 1 year ago

hey @moseleyi i've added a hubspot_ticket_deal_enabled variable that's false by default, this should let you just bypass these models since you don't have the ticket_deal source table (which most people don't)

if you'd like to try it out:

packages:
  - git: https://github.com/fivetran/dbt_hubspot_source.git
    revision: feature/disable-ticket-deal
    warn-unpinned: false
moseleyi commented 1 year ago

hmm is this not going to clash with the fivetran/hubspot package since it already has a hubspot_source dependency?

fivetran-jamie commented 1 year ago

ah yeah -- lemme change the hubspot bugfix/deleted-stages branch to refer to this feature/disable-ticket-deal branch of the source package, so you can test both with that one package reference

fivetran-jamie commented 1 year ago

ok the transform package should reference this branch, so you can remove the dbt_hubspot_source package reference from your packages.yml

moseleyi commented 1 year ago

I ran the dbt deps

image

and I have this:

  hubspot_service_enabled: true
  hubspot_ticket_deal_enabled: false

And the ticket deal doesn't show an error anymore. What tables should I see for tickets? I can see the stg_ views but not the ticket-related tables

fivetran-jamie commented 1 year ago

like no ticket-related staging models are showing up? that would mean it's not capturing that you have the hubspot_service_enabled var set to true 🤔

moseleyi commented 1 year ago

STaging views are created:

image

but no actual ticket-related materialised tables

fivetran-jamie commented 1 year ago

ah by ticket-related materialised tables do you mean transform models? if so, the transform package actually doesn't do anything with tickets -- the source package just creates staging models for them

fivetran-jamie commented 1 year ago

or rather do you mean you'd want these views materialized as tables?

moseleyi commented 1 year ago

Ahh okay, I thought tables would also be built automatically like for others but I see it's not in the hubspot package

fivetran-joemarkiewicz commented 1 year ago

Closing this issue as it has since been resolved.