Skip to content
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

Updates for dbt-utils to dbt-core cross-db macro migration #86

Merged
merged 31 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7fa2ed1
Updates for dbt-utils to dbt-core cross-db macro migration
fivetran-sheringuyen Oct 17, 2022
dc986e7
Updating dbt version
fivetran-sheringuyen Oct 17, 2022
eb01658
Updating dbt version
fivetran-sheringuyen Oct 17, 2022
a5231c0
Updating package dependencies
fivetran-sheringuyen Oct 17, 2022
7e0442f
deleting file: .circleci/config.yml
fivetran-sheringuyen Oct 17, 2022
ad0fbbd
deleting file: integration_tests/requirements.txt
fivetran-sheringuyen Oct 17, 2022
5219e30
deleting file: integration_tests/ci/sample.profiles.yml
fivetran-sheringuyen Oct 17, 2022
0f5d3ba
adding file: integration_tests/requirements.txt
fivetran-sheringuyen Oct 17, 2022
4987f84
adding file: integration_tests/ci/sample.profiles.yml
fivetran-sheringuyen Oct 17, 2022
eca085d
adding file: .buildkite/pipeline.yml
fivetran-sheringuyen Oct 17, 2022
f9d3486
adding file: .buildkite/scripts/run_models.sh
fivetran-sheringuyen Oct 17, 2022
156a8b5
adding file: .buildkite/hooks/pre-command
fivetran-sheringuyen Oct 17, 2022
f5f00f3
Correct config variable name in README
MarcelloMolinaro Oct 18, 2022
3b0291f
updates
fivetran-reneeli Oct 25, 2022
76b4336
rm databricks
fivetran-reneeli Oct 26, 2022
eec982d
update
fivetran-reneeli Oct 26, 2022
6cf8b2c
try formatting fix
fivetran-reneeli Oct 26, 2022
3ed591a
Trigger Build
fivetran-reneeli Oct 27, 2022
29cbad8
update version
fivetran-reneeli Oct 28, 2022
0abd11e
fix deps
fivetran-reneeli Oct 28, 2022
e1287a6
fix hubspot_engagement_calls_enabled variable
fivetran-reneeli Oct 31, 2022
0509885
revert
fivetran-reneeli Oct 31, 2022
b44c376
Merge pull request #87 from MozartData/MarcelloMolinaro-readme-fix
fivetran-reneeli Nov 1, 2022
bc016c9
databricks
fivetran-jamie Nov 7, 2022
28ac83c
tweaks
fivetran-jamie Nov 8, 2022
d40bf12
merged into migration branch
fivetran-jamie Nov 14, 2022
7e2ebfa
Merge pull request #89 from fivetran/feature/databricks-compat
fivetran-jamie Nov 15, 2022
a181e51
Update pipeline, CI refs, run models
fivetran-sheringuyen Nov 17, 2022
86d6f6f
Update run_models.sh
fivetran-sheringuyen Nov 17, 2022
a6f56cc
docs regen
fivetran-joemarkiewicz Dec 19, 2022
7d133d2
update package dependency
fivetran-joemarkiewicz Dec 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

set -e

# Export secrets for Docker containers.
# Restrict exposing secrets only to the steps that need them
export GCLOUD_SERVICE_KEY=$(gcloud secrets versions access latest --secret="GCLOUD_SERVICE_KEY" --project="dbt-package-testing-363917")
export CI_POSTGRES_DBT_HOST=$(gcloud secrets versions access latest --secret="CI_POSTGRES_DBT_HOST" --project="dbt-package-testing-363917")
export CI_POSTGRES_DBT_USER=$(gcloud secrets versions access latest --secret="CI_POSTGRES_DBT_USER" --project="dbt-package-testing-363917")
export CI_POSTGRES_DBT_PASS=$(gcloud secrets versions access latest --secret="CI_POSTGRES_DBT_PASS" --project="dbt-package-testing-363917")
export CI_POSTGRES_DBT_DBNAME=$(gcloud secrets versions access latest --secret="CI_POSTGRES_DBT_DBNAME" --project="dbt-package-testing-363917")
export CI_REDSHIFT_DBT_DBNAME=$(gcloud secrets versions access latest --secret="CI_REDSHIFT_DBT_DBNAME" --project="dbt-package-testing-363917")
export CI_REDSHIFT_DBT_HOST=$(gcloud secrets versions access latest --secret="CI_REDSHIFT_DBT_HOST" --project="dbt-package-testing-363917")
export CI_REDSHIFT_DBT_PASS=$(gcloud secrets versions access latest --secret="CI_REDSHIFT_DBT_PASS" --project="dbt-package-testing-363917")
export CI_REDSHIFT_DBT_USER=$(gcloud secrets versions access latest --secret="CI_REDSHIFT_DBT_USER" --project="dbt-package-testing-363917")
export CI_SNOWFLAKE_DBT_ACCOUNT=$(gcloud secrets versions access latest --secret="CI_SNOWFLAKE_DBT_ACCOUNT" --project="dbt-package-testing-363917")
export CI_SNOWFLAKE_DBT_DATABASE=$(gcloud secrets versions access latest --secret="CI_SNOWFLAKE_DBT_DATABASE" --project="dbt-package-testing-363917")
export CI_SNOWFLAKE_DBT_PASS=$(gcloud secrets versions access latest --secret="CI_SNOWFLAKE_DBT_PASS" --project="dbt-package-testing-363917")
export CI_SNOWFLAKE_DBT_ROLE=$(gcloud secrets versions access latest --secret="CI_SNOWFLAKE_DBT_ROLE" --project="dbt-package-testing-363917")
export CI_SNOWFLAKE_DBT_USER=$(gcloud secrets versions access latest --secret="CI_SNOWFLAKE_DBT_USER" --project="dbt-package-testing-363917")
export CI_SNOWFLAKE_DBT_WAREHOUSE=$(gcloud secrets versions access latest --secret="CI_SNOWFLAKE_DBT_WAREHOUSE" --project="dbt-package-testing-363917")
export CI_DATABRICKS_DBT_HOST=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HOST" --project="dbt-package-testing-363917")
export CI_DATABRICKS_DBT_HTTP_PATH=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HTTP_PATH" --project="dbt-package-testing-363917")
export CI_DATABRICKS_DBT_TOKEN=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_TOKEN" --project="dbt-package-testing-363917")
73 changes: 73 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
steps:
- label: ":postgres: Run Tests - Postgres"
key: "run-dbt-postgres"
plugins:
- docker#v3.13.0:
image: "python:3.8"
shell: [ "/bin/bash", "-e", "-c" ]
environment:
- "BASH_ENV=/tmp/.bashrc"
- "CI_POSTGRES_DBT_DBNAME"
- "CI_POSTGRES_DBT_HOST"
- "CI_POSTGRES_DBT_PASS"
- "CI_POSTGRES_DBT_USER"
commands: |
bash .buildkite/scripts/run_models.sh postgres

- label: ":snowflake-db: Run Tests - Snowflake"
key: "run_dbt_snowflake"
plugins:
- docker#v3.13.0:
image: "python:3.8"
shell: [ "/bin/bash", "-e", "-c" ]
environment:
- "BASH_ENV=/tmp/.bashrc"
- "CI_SNOWFLAKE_DBT_ACCOUNT"
- "CI_SNOWFLAKE_DBT_DATABASE"
- "CI_SNOWFLAKE_DBT_PASS"
- "CI_SNOWFLAKE_DBT_ROLE"
- "CI_SNOWFLAKE_DBT_USER"
- "CI_SNOWFLAKE_DBT_WAREHOUSE"
commands: |
bash .buildkite/scripts/run_models.sh snowflake

- label: ":gcloud: Run Tests - BigQuery"
key: "run_dbt_bigquery"
plugins:
- docker#v3.13.0:
image: "python:3.8"
shell: [ "/bin/bash", "-e", "-c" ]
environment:
- "BASH_ENV=/tmp/.bashrc"
- "GCLOUD_SERVICE_KEY"
commands: |
bash .buildkite/scripts/run_models.sh bigquery

- label: ":amazon-redshift: Run Tests - Redshift"
key: "run_dbt_redshift"
plugins:
- docker#v3.13.0:
image: "python:3.8"
shell: [ "/bin/bash", "-e", "-c" ]
environment:
- "BASH_ENV=/tmp/.bashrc"
- "CI_REDSHIFT_DBT_DBNAME"
- "CI_REDSHIFT_DBT_HOST"
- "CI_REDSHIFT_DBT_PASS"
- "CI_REDSHIFT_DBT_USER"
commands: |
bash .buildkite/scripts/run_models.sh redshift

- label: ":bricks: Run Tests - Databricks"
key: "run_dbt_databricks"
plugins:
- docker#v3.13.0:
image: "python:3.8"
shell: [ "/bin/bash", "-e", "-c" ]
environment:
- "BASH_ENV=/tmp/.bashrc"
- "CI_DATABRICKS_DBT_HOST"
- "CI_DATABRICKS_DBT_HTTP_PATH"
- "CI_DATABRICKS_DBT_TOKEN"
commands: |
bash .buildkite/scripts/run_models.sh databricks
26 changes: 26 additions & 0 deletions .buildkite/scripts/run_models.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -euo pipefail

apt-get update
apt-get install libsasl2-dev

python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip setuptools
pip install -r integration_tests/requirements.txt
mkdir -p ~/.dbt
cp integration_tests/ci/sample.profiles.yml ~/.dbt/profiles.yml

db=$1
echo `pwd`
cd integration_tests
dbt deps
dbt seed --target "$db" --full-refresh
dbt run --target "$db" --full-refresh
dbt test --target "$db"
dbt run --vars '{hubspot_marketing_enabled: true, hubspot_sales_enabled: false}' --target "$db" --full-refresh
dbt run --vars '{hubspot_marketing_enabled: true, hubspot_contact_merge_audit_enabled: true, hubspot_sales_enabled: false}' --target "$db" --full-refresh
dbt run --vars '{hubspot_marketing_enabled: false, hubspot_sales_enabled: true}' --target "$db" --full-refresh
dbt run --vars '{hubspot_marketing_enabled: false, hubspot_sales_enabled: false}' --target "$db" --full-refresh
dbt test --target "$db"
85 changes: 0 additions & 85 deletions .circleci/config.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

**How did you test the PR changes?**
<!--- Proof of testing is required in order for the PR to be approved. -->
<!--- To check a box, remove the space and insert an x in the box (eg. [x] CircleCi). -->
<!--- To check a box, remove the space and insert an x in the box (eg. [x] Buildkite). -->
<!--- To select a checkbox you simply need to add an "x" with no spaces between the brackets (eg. [x] Yes). -->
- [ ] CircleCi <!--- CircleCi testing is only applicable to Fivetran employees. -->
- [ ] Buildkite <!--- Buildkite testing is only applicable to Fivetran employees. -->
- [ ] Local (please provide additional testing details below)

**Select which warehouse(s) were used to test the PR**
Expand Down
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
# dbt_hubspot v0.7.0

## 🚨 Breaking Changes 🚨:
[PR #86](https://github.com/fivetran/dbt_hubspot/pull/86) includes the following breaking changes:
- Dispatch update for dbt-utils to dbt-core cross-db macros migration. Specifically `{{ dbt_utils.<macro> }}` have been updated to `{{ dbt.<macro> }}` for the below macros:
- `any_value`
- `bool_or`
- `cast_bool_to_text`
- `concat`
- `date_trunc`
- `dateadd`
- `datediff`
- `escape_single_quotes`
- `except`
- `hash`
- `intersect`
- `last_day`
- `length`
- `listagg`
- `position`
- `replace`
- `right`
- `safe_cast`
- `split_part`
- `string_literal`
- `type_bigint`
- `type_float`
- `type_int`
- `type_numeric`
- `type_string`
- `type_timestamp`
- `array_append`
- `array_concat`
- `array_construct`
- For `current_timestamp` and `current_timestamp_in_utc` macros, the dispatch AND the macro names have been updated to the below, respectively:
- `dbt.current_timestamp_backcompat`
- `dbt.current_timestamp_in_utc_backcompat`
- `dbt_utils.surrogate_key` has also been updated to `dbt_utils.generate_surrogate_key`. Since the method for creating surrogate keys differ, we suggest all users do a `full-refresh` for the most accurate data. For more information, please refer to dbt-utils [release notes](https://github.com/dbt-labs/dbt-utils/releases) for this update.
- Dependencies on `fivetran/fivetran_utils` have been upgraded, previously `[">=0.3.0", "<0.4.0"]` now `[">=0.4.0", "<0.5.0"]`.

## 🎉 Features
- 🧱 Databricks compatibility! [(PR #89)](https://github.com/fivetran/dbt_hubspot/pull/89)

# dbt_hubspot v0.6.3
PR [#84](https://github.com/fivetran/dbt_hubspot/pull/84) incorporates the following updates:
## Fixes
Expand Down
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
href="https://github.com/fivetran/dbt_hubspot/blob/main/LICENSE">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" /></a>
<a alt="dbt-core">
<img src="https://img.shields.io/badge/dbt_Core™_version->=1.0.0_,<2.0.0-orange.svg" /></a>
`<img src="https://img.shields.io/badge/dbt_Core™_version->=1.3.0_,<2.0.0-orange.svg" /></a>`
<a alt="Maintained?">
<img src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" /></a>
<a alt="PRs">
Expand Down Expand Up @@ -42,15 +42,23 @@ The following table provides a detailed list of all models materialized within t
To use this dbt package, you must have the following:

- At least one Fivetran HubSpot connector syncing data into your destination.
- A **BigQuery**, **Snowflake**, **Redshift**, or **PostgreSQL** destination.
- A **BigQuery**, **Snowflake**, **Redshift**, **PostgreSQL**, or **Databricks** destination.

### Databricks Dispatch Configuration
If 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.
```yml
dispatch:
- macro_namespace: dbt_utils
search_order: ['spark_utils', 'dbt_utils']
```

## Step 2: Install the package
Include the following hubspot package version in your `packages.yml` file:
> 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.
```yaml
packages:
- package: fivetran/hubspot
version: [">=0.6.0", "<0.7.0"]
version: [">=0.7.0", "<0.8.0"]

```
## Step 3: Define database and schema variables
Expand Down Expand Up @@ -101,7 +109,7 @@ vars:
hubspot_engagement_contact_enabled: false
hubspot_engagement_company_enabled: false
hubspot_engagement_deal_enabled: false
hubspot_engagement_calls_enabled: false
hubspot_engagement_call_enabled: false
hubspot_engagement_emails_enabled: false
hubspot_engagement_meetings_enabled: false
hubspot_engagement_notes_enabled: false
Expand Down Expand Up @@ -214,13 +222,16 @@ This dbt package is dependent on the following dbt packages. Please be aware tha
```yml
packages:
- package: fivetran/hubspot_source
version: [">=0.6.0", "<0.7.0"]
version: [">=0.7.0", "<0.8.0"]

- package: fivetran/fivetran_utils
version: [">=0.3.0", "<0.4.0"]
version: [">=0.4.0", "<0.5.0"]

- package: dbt-labs/dbt_utils
version: [">=0.8.0", "<0.9.0"]
version: [">=1.0.0", "<2.0.0"]

- package: dbt-labs/spark_utils
version: [">=0.3.0", "<0.4.0"]
```
# 🙌 How is this package maintained and can I contribute?
## Package Maintenance
Expand All @@ -238,4 +249,4 @@ We highly encourage and welcome contributions to this package. Check out [this d
Additional contributions to this package are very welcome! Please create issues
or open PRs against `main`. Check out
[this post](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657)
on the best workflow for contributing to a package.
on the best workflow for contributing to a package.
14 changes: 2 additions & 12 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
name: 'hubspot'
version: '0.6.3'
version: '0.7.0'
config-version: 2
require-dbt-version: [">=1.0.0", "<2.0.0"]

require-dbt-version: [">=1.3.0", "<2.0.0"]
vars:
hubspot:
contact: "{{ ref('stg_hubspot__contact') }}"
contact_merge_audit: "{{ ref('stg_hubspot__contact_merge_audit') }}"
contact_list: "{{ ref('stg_hubspot__contact_list') }}"
contact_list_member: "{{ ref('stg_hubspot__contact_list_member') }}"
contact_property_history: "{{ ref('stg_hubspot__contact_property_history') }}"

company: "{{ ref('stg_hubspot__company') }}"
company_property_history: "{{ ref('stg_hubspot__company_property_history') }}"

deal: "{{ ref('stg_hubspot__deal') }}"
deal_stage: "{{ ref('stg_hubspot__deal_stage') }}"
deal_company: "{{ ref('stg_hubspot__deal_company') }}"
deal_pipeline: "{{ ref('stg_hubspot__deal_pipeline') }}"
deal_pipeline_stage: "{{ ref('stg_hubspot__deal_pipeline_stage') }}"
deal_property_history: "{{ ref('stg_hubspot__deal_property_history') }}"

owner: "{{ ref('stg_hubspot__owner') }}"

email_event_bounce: "{{ ref('stg_hubspot__email_event_bounce') }}"
email_event_click: "{{ ref('stg_hubspot__email_event_click') }}"
email_event_deferred: "{{ ref('stg_hubspot__email_event_deferred') }}"
Expand All @@ -35,7 +30,6 @@ vars:
email_event_spam_report: "{{ ref('stg_hubspot__email_event_spam_report') }}"
email_event_status_change: "{{ ref('stg_hubspot__email_event_status_change') }}"
email_event: "{{ ref('stg_hubspot__email_event') }}"

engagement: "{{ ref('stg_hubspot__engagement') }}"
engagement_call: "{{ ref('stg_hubspot__engagement_call') }}"
engagement_company: "{{ ref('stg_hubspot__engagement_company') }}"
Expand All @@ -47,12 +41,8 @@ vars:
engagement_meeting: "{{ ref('stg_hubspot__engagement_meeting') }}"
engagement_note: "{{ ref('stg_hubspot__engagement_note') }}"
engagement_task: "{{ ref('stg_hubspot__engagement_task') }}"

email_metrics: ['bounces', 'clicks', 'deferrals', 'deliveries', 'drops', 'forwards', 'opens', 'prints', 'spam_reports', 'unsubscribes']

#Contact Merge Audit Enable Variable
hubspot_contact_merge_audit_enabled: false

models:
hubspot:
+materialized: table
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

Loading