{"id":22793275,"url":"https://github.com/fivetran/dbt_hubspot_source","last_synced_at":"2025-10-25T14:32:18.534Z","repository":{"id":37953328,"uuid":"270778658","full_name":"fivetran/dbt_hubspot_source","owner":"fivetran","description":"Data models for Hubspot built using dbt.","archived":false,"fork":false,"pushed_at":"2025-03-05T16:36:45.000Z","size":3512,"stargazers_count":35,"open_issues_count":11,"forks_count":34,"subscribers_count":39,"default_branch":"main","last_synced_at":"2025-04-02T06:59:27.137Z","etag":null,"topics":["dbt","dbt-packages","fivetran","hubspot"],"latest_commit_sha":null,"homepage":"https://fivetran.github.io/dbt_hubspot_source/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fivetran.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-08T18:22:35.000Z","updated_at":"2025-04-01T04:36:51.000Z","dependencies_parsed_at":"2024-12-12T03:19:12.124Z","dependency_job_id":"be2c8292-bb97-4459-b649-b2b08ae17b6c","html_url":"https://github.com/fivetran/dbt_hubspot_source","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_hubspot_source","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_hubspot_source/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_hubspot_source/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_hubspot_source/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fivetran","download_url":"https://codeload.github.com/fivetran/dbt_hubspot_source/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036064,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dbt","dbt-packages","fivetran","hubspot"],"created_at":"2024-12-12T03:18:58.627Z","updated_at":"2025-10-25T14:32:18.528Z","avatar_url":"https://github.com/fivetran.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [DEPRECATED] HubSpot Source dbt Package\n\n\u003e _This package has been archived and is no longer maintained. Use [`dbt_hubspot`](https://github.com/fivetran/dbt_hubspot) instead, which now contains all models previously found here._\n\n\u003cp align=\"left\"\u003e\n    \u003ca alt=\"License\"\n        href=\"https://github.com/fivetran/dbt_hubspot_source/blob/main/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" /\u003e\u003c/a\u003e\n    \u003ca alt=\"dbt-core\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/dbt_Core™_version-\u003e=1.3.0_,\u003c2.0.0-orange.svg\" /\u003e\u003c/a\u003e\n    \u003ca alt=\"Maintained?\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Maintained%3F-no-green.svg\" /\u003e\u003c/a\u003e\n    \u003ca alt=\"PRs\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Contributions-closed-blueviolet\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## What does this dbt package do?\n\u003c!--section=\"hubspot_source_model\"--\u003e\n- Materializes [HubSpot staging tables](https://fivetran.github.io/dbt_hubspot_source/#!/overview/hubspot_source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/hubspot#schemainformation). These staging tables clean, test, and prepare your HubSpot data from [Fivetran's connector](https://fivetran.com/docs/applications/hubspot) for analysis by doing the following:\n  - Name columns for consistency across all packages and for easier analysis\n  - Adds freshness tests to source data. dbt Core \u003e= 1.9.6 is required to run freshness tests out of the box.\n  - Adds column-level testing where applicable. For example, all primary keys are tested for uniqueness and non-null values.\n- Generates a comprehensive data dictionary of your HubSpot data through the [dbt docs site](https://fivetran.github.io/dbt_hubspot_source/).\n- These tables are designed to work simultaneously with our [HubSpot transformation package](https://github.com/fivetran/dbt_hubspot).\n\u003c!--section-end--\u003e\n\n## How do I use the dbt package?\n### Step 1: Prerequisites\nTo use this dbt package, you must have the following:\n- At least one Fivetran HubSpot connection syncing data into your destination.\n- A **BigQuery**, **Snowflake**, **Redshift**, **PostgreSQL**, or **Databricks** destination.\n\n#### Databricks Dispatch Configuration\nIf you are using a Databricks destination with this package you will need to add the below (or a variation of the below) dispatch configuration within your `dbt_project.yml`. This is required in order for the package to accurately search for macros within the `dbt-labs/spark_utils` then the `dbt-labs/dbt_utils` packages respectively.\n```yml\ndispatch:\n  - macro_namespace: dbt_utils\n    search_order: ['spark_utils', 'dbt_utils']\n```\n\n### Step 2: Install the package (skip if also using the `hubspot` transformation package)\nInclude the following hubspot_source package version in your `packages.yml` file.\n\u003e TIP: Check [dbt Hub](https://hub.getdbt.com/) for the latest installation instructions or [read the dbt docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages.\n```yaml\npackages:\n  - package: fivetran/hubspot_source\n    version: [\"\u003e=0.21.0\", \"\u003c0.22.0\"]\n```\n### Step 3: Define database and schema variables\nBy default, this package runs using your destination and the `hubspot` schema. If this is not where your HubSpot data is (for example, if your HubSpot schema is named `hubspot_fivetran`), add the following configuration to your root `dbt_project.yml` file:\n\n```yml\nvars:\n    hubspot_database: your_destination_name\n    hubspot_schema: your_schema_name \n```\n\n### Step 4: Disable/enable models and sources\nWhen 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 the exception of**:\n\n- `hubspot_service_enabled`\n- `hubspot_ticket_deal_enabled`\n- `hubspot_contact_merge_audit_enabled`\n- `hubspot_merged_deal_enabled`\n- `hubspot_engagement_communication_enabled`\n\nThese default to `false` and must be explicitly enabled if needed. You only need to add variables for the sources that differ from their defaults.\n\n```yml\nvars:\n  # Marketing\n\n  hubspot_marketing_enabled: false                        # Disables all marketing models\n  hubspot_contact_enabled: false                          # Disables the contact models\n  hubspot_contact_form_enabled: false                     # Disables form and contact form submission data and its relationship to contacts\n  hubspot_contact_list_enabled: false                     # Disables contact list models\n  hubspot_contact_list_member_enabled: false              # Disables contact list member models\n  hubspot_contact_merge_audit_enabled: true               # Enables the use of the CONTACT_MERGE_AUDIT table (deprecated by Hubspot v3 API) for removing merged contacts in the final models.\n                                                          # If false, contacts will still be merged using the CONTACT.property_hs_calculated_merged_vids field.\n                                                          # Default = false\n  hubspot_contact_property_enabled: false                 # Disables the contact property models\n  hubspot_contact_property_history_enabled: false         # Disables the contact property history models\n  hubspot_email_event_enabled: false                      # Disables all email_event models and functionality\n  hubspot_email_event_bounce_enabled: false\n  hubspot_email_event_click_enabled: false\n  hubspot_email_event_deferred_enabled: false\n  hubspot_email_event_delivered_enabled: false\n  hubspot_email_event_dropped_enabled: false\n  hubspot_email_event_forward_enabled: false\n  hubspot_email_event_click_enabled: false\n  hubspot_email_event_open_enabled: false\n  hubspot_email_event_print_enabled: false\n  hubspot_email_event_sent_enabled: false\n  hubspot_email_event_spam_report_enabled: false\n  hubspot_email_event_status_change_enabled: false\n\n  # Sales\n\n  hubspot_sales_enabled: false                            # Disables all sales models\n  hubspot_company_enabled: false\n  hubspot_company_property_history_enabled: false         # Disables the company property history models\n  hubspot_deal_enabled: false\n  hubspot_deal_company_enabled: false\n  hubspot_deal_contact_enabled: false\n  hubspot_deal_property_history_enabled: false            # Disables the deal property history models\n  hubspot_engagement_enabled: false                       # Disables all engagement models and functionality\n  hubspot_engagement_call_enabled: false\n  hubspot_engagement_company_enabled: false\n  hubspot_engagement_communication_enabled: true          # Enables the link between communications and engagements\n  hubspot_engagement_contact_enabled: false\n  hubspot_engagement_deal_enabled: false\n  hubspot_engagement_email_enabled: false\n  hubspot_engagement_meeting_enabled: false\n  hubspot_engagement_note_enabled: false\n  hubspot_engagement_task_enabled: false\n  hubspot_merged_deal_enabled: true                       # Enables the merged_deal table to filter merged deals from final models. Default = false\n  hubspot_owner_enabled: false\n  hubspot_property_enabled: false                         # Disables property and property_option tables\n  hubspot_role_enabled: false                             # Disables role metadata\n  hubspot_team_enabled: false                             # Disables team metadata\n  hubspot_team_user_enabled: false                        # Disables user-to-team relationships\n\n  # Service\n  hubspot_service_enabled: true                           # Enables all service models\n  hubspot_ticket_deal_enabled: true\n```\n\n#### dbt-core Version Requirement for disabling freshness tests\nIf you are not using a source table that involves freshness tests, please be aware that the feature to disable freshness was only introduced in dbt-core 1.1.0. Therefore ensure the dbt version you're using is v1.1.0 or greater for this config to work.\n\n### (Optional) Step 5: Additional configurations\n\n#### Adding passthrough columns\nThis package includes all source columns defined in the macros folder. Models by default only bring in a few fields for the `company`, `contact`, `deal`, and `ticket` tables. You can add more columns using our pass-through column variables. These variables allow for the pass-through fields to be aliased (`alias`) and casted (`transform_sql`) if desired, but not required. Datatype casting is configured via a sql snippet within the `transform_sql` key. You may add the desired sql while omitting the `as field_name` at the end and your custom pass-though fields will be casted accordingly. Use the below format for declaring the respective pass-through variables within your root `dbt_project.yml`.\n\n```yml\nvars:\n  hubspot__deal_pass_through_columns:\n    - name:           \"property_field_new_id\"\n      alias:          \"new_name_for_this_field_id\"\n      transform_sql:  \"cast(new_name_for_this_field as int64)\"\n    - name:           \"this_other_field\"\n      transform_sql:  \"cast(this_other_field as string)\"\n  hubspot__contact_pass_through_columns:\n    - name:           \"wow_i_can_add_all_my_custom_fields\"\n  hubspot__company_pass_through_columns:\n    - name:           \"this_is_radical\"\n      alias:          \"radical_field\"\n      transform_sql:  \"cast(radical_field as string)\"\n  hubspot__ticket_pass_through_columns:\n    - name:           \"property_mmm\"\n      alias:          \"mmm\"\n    - name:           \"property_hs_bop\"\n      alias:          \"bop\"\n```\n**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.\n\n```yml\nvars:\n  hubspot__pass_through_all_columns: true # default is false\n```\n\n#### Adding property label\nFor `property_hs_*` columns, you can enable the corresponding, human-readable `property_option`.`label` to be included in the staging models.\n\n##### Important\n- You must have sources `property` and `property_option` enabled to enable labels. By default, these sources are enabled.\n- You CANNOT enable labels if using `hubspot__pass_through_all_columns: true`.`\n- We recommend being selective with the label columns you add. As you add more label columns, your run time will increase due to the underlying logic requirements.\n\nTo enable labels for a given property, set the property attribute `add_property_label: true`, using the below format.\n\n```yml\nvars:\n  hubspot__ticket_pass_through_columns:\n    - name: \"property_hs_fieldname\"\n      alias: \"fieldname\"\n      add_property_label: true\n```\n\nAlternatively, you can enable labels for all passthrough properties by using variable `hubspot__enable_all_property_labels: true`, formatted like the below example.\n\n```yml\nvars:\n  hubspot__enable_all_property_labels: true # cannot use in conjunction with `hubspot__pass_through_all_columns: true`\n  hubspot__ticket_pass_through_columns:\n    - name: \"property_hs_fieldname1\"\n    - name: \"property_hs_fieldname2\"\n```\n#### Including calculated fields\nThis 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.\n```yml\nvars:\n  hubspot__deal_calculated_fields:\n    - name:          \"deal_calculated_field\"\n      transform_sql: \"existing_field * other_field\"\n  hubspot__company_calculated_fields:\n    - name:          \"company_calculated_field\"\n      transform_sql: \"concat(name_field, '_company_name')\"\n  hubspot__contact_calculated_fields:\n    - name:          \"contact_calculated_field\"\n      transform_sql: \"contact_revenue - contact_expense\"\n  hubspot__ticket_calculated_fields:\n    - name:          \"ticket_calculated_field\"\n      transform_sql: \"total_field / other_total_field\"\n```\n#### Filter email events\nWhen leveraging email events, HubSpot customers may take advantage of filtering out specified email events. These filtered email events are present within the `stg_hubspot__email_events` model and are identified by the `is_filtered_event` boolean field. By default, these events are included in the staging and downstream models generated from this package. However, if you wish to remove these filtered events you may do so by setting the `hubspot_using_all_email_events` variable to false. See below for exact configurations you may provide in your `dbt_project.yml` file:\n```yml\nvars:\n  hubspot_using_all_email_events: false # True by default\n```\n\n#### Change the build schema\nBy default, this package builds the hubspot staging models within a schema titled (`\u003ctarget_schema\u003e` + `_stg_hubspot`) in your destination. If this is not where you would like your hubspot staging data to be written to, add the following configuration to your root `dbt_project.yml` file:\n\n```yml\nmodels:\n    hubspot_source:\n      +schema: my_new_schema_name # leave blank for just the target_schema\n```\n\n#### Change the source table references\nIf an individual source table has a different name than the package expects, add the table name as it appears in your destination to the respective variable:\n\u003e IMPORTANT: See this project's [`dbt_project.yml`](https://github.com/fivetran/dbt_hubspot_source/blob/main/dbt_project.yml) variable declarations to see the expected names.\n\n```yml\nvars:\n    hubspot_\u003cdefault_source_table_name\u003e_identifier: your_table_name \n```\n\n### (Optional) Step 6: Orchestrate your models with Fivetran Transformations for dbt Core™\n\nFivetran offers the ability for you to orchestrate your dbt project through [Fivetran Transformations for dbt Core™](https://fivetran.com/docs/transformations/dbt). Learn how to set up your project for orchestration through Fivetran in our [Transformations for dbt Core setup guides](https://fivetran.com/docs/transformations/dbt#setupguide).\n\n## Does this package have dependencies?\nThis dbt package is dependent on the following dbt packages. These dependencies are installed by default within this package. For more information on the following packages, refer to the [dbt hub](https://hub.getdbt.com/) site.\n\u003e IMPORTANT: If you have any of these dependent packages in your own `packages.yml` file, we highly recommend that you remove them from your root `packages.yml` to avoid package version conflicts.\n```yml\npackages:\n    - package: fivetran/fivetran_utils\n      version: [\"\u003e=0.4.0\", \"\u003c0.5.0\"]\n    - package: dbt-labs/dbt_utils\n      version: [\"\u003e=1.0.0\", \"\u003c2.0.0\"]\n    - package: dbt-labs/spark_utils\n      version: [\"\u003e=0.3.0\", \"\u003c0.4.0\"]\n```\n\n## How is this package maintained and can I contribute?\n### Package Maintenance\nThe Fivetran team maintaining this package _only_ maintains the latest version of the package. We highly recommend that you stay consistent with the [latest version](https://hub.getdbt.com/fivetran/hubspot_source/latest/) of the package and refer to the [CHANGELOG](https://github.com/fivetran/dbt_hubspot_source/blob/main/CHANGELOG.md) and release notes for more information on changes across versions.\n\n### Contributions\nA small team of analytics engineers at Fivetran develops these dbt packages. However, the packages are made better by community contributions.\n\nWe highly encourage and welcome contributions to this package. Check out [this dbt Discourse article](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) to learn how to contribute to a dbt package.\n\n## Are there any resources available?\n- If you have questions or want to reach out for help, see the [GitHub Issue](https://github.com/fivetran/dbt_hubspot_source/issues/new/choose) section to find the right avenue of support for you.\n- If you would like to provide feedback to the dbt package team at Fivetran or would like to request a new dbt package, fill out our [Feedback Form](https://www.surveymonkey.com/r/DQ7K7WW).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffivetran%2Fdbt_hubspot_source","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffivetran%2Fdbt_hubspot_source","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffivetran%2Fdbt_hubspot_source/lists"}