Skip to content

Commit 8cf68f5

Browse files
fivetran-joemarkiewiczfivetran-catfritzfivetran-avinash
authored
bugfix/is-incremental-compatible (#4)
* bugfix/is-incremental-compatible * PR link ref in CHANGELOG * Update README.md Co-authored-by: fivetran-catfritz <111930712+fivetran-catfritz@users.noreply.github.com> * Update integration_tests/tests/consistency/consistency_events_enhanced.sql Co-authored-by: fivetran-catfritz <111930712+fivetran-catfritz@users.noreply.github.com> * review updates * Apply suggestions from code review Co-authored-by: Avinash Kunnath <108772760+fivetran-avinash@users.noreply.github.com> * address release review notes --------- Co-authored-by: fivetran-catfritz <111930712+fivetran-catfritz@users.noreply.github.com> Co-authored-by: Avinash Kunnath <108772760+fivetran-avinash@users.noreply.github.com>
1 parent 7972896 commit 8cf68f5

16 files changed

Lines changed: 190 additions & 55 deletions

.buildkite/hooks/pre-command

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ export CI_SNOWFLAKE_DBT_WAREHOUSE=$(gcloud secrets versions access latest --secr
2222
export CI_DATABRICKS_DBT_HOST=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HOST" --project="dbt-package-testing-363917")
2323
export CI_DATABRICKS_DBT_HTTP_PATH=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HTTP_PATH" --project="dbt-package-testing-363917")
2424
export CI_DATABRICKS_DBT_TOKEN=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_TOKEN" --project="dbt-package-testing-363917")
25-
export CI_DATABRICKS_DBT_CATALOG=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_CATALOG" --project="dbt-package-testing-363917")
25+
export CI_DATABRICKS_DBT_CATALOG=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_CATALOG" --project="dbt-package-testing-363917")
26+
export CI_DATABRICKS_SQL_DBT_HTTP_PATH=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_SQL_DBT_HTTP_PATH" --project="dbt-package-testing-363917")
27+
export CI_DATABRICKS_SQL_DBT_TOKEN=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_SQL_DBT_TOKEN" --project="dbt-package-testing-363917")

.buildkite/pipeline.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,19 @@ steps:
7171
- "CI_DATABRICKS_DBT_TOKEN"
7272
- "CI_DATABRICKS_DBT_CATALOG"
7373
commands: |
74-
bash .buildkite/scripts/run_models.sh databricks
74+
bash .buildkite/scripts/run_models.sh databricks
75+
76+
- label: ":databricks: :database: Run Tests - Databricks SQL Warehouse"
77+
key: "run_dbt_databricks_sql"
78+
plugins:
79+
- docker#v3.13.0:
80+
image: "python:3.8"
81+
shell: [ "/bin/bash", "-e", "-c" ]
82+
environment:
83+
- "BASH_ENV=/tmp/.bashrc"
84+
- "CI_DATABRICKS_DBT_HOST"
85+
- "CI_DATABRICKS_SQL_DBT_HTTP_PATH"
86+
- "CI_DATABRICKS_SQL_DBT_TOKEN"
87+
- "CI_DATABRICKS_DBT_CATALOG"
88+
commands: |
89+
bash .buildkite/scripts/run_models.sh databricks-sql

.buildkite/scripts/run_models.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,23 @@ db=$1
1616
echo `pwd`
1717
cd integration_tests
1818
dbt deps
19+
if [ "$db" = "databricks-sql" ]; then
20+
dbt seed --vars '{salesforce_marketing_cloud_schema: sfmc_sqlw_tests}' --target "$db" --full-refresh
21+
dbt run --vars '{salesforce_marketing_cloud_schema: sfmc_sqlw_tests}' --target "$db" --full-refresh
22+
dbt test --vars '{salesforce_marketing_cloud_schema: sfmc_sqlw_tests}' --target "$db"
23+
dbt run --vars '{salesforce_marketing_cloud_schema: sfmc_sqlw_tests}' --target "$db"
24+
dbt test --vars '{salesforce_marketing_cloud_schema: sfmc_sqlw_tests}' --target "$db"
25+
dbt run --vars '{salesforce_marketing_cloud_schema: sfmc_sqlw_tests, salesforce_marketing_cloud__link_enabled: false, salesforce_marketing_cloud__list_enabled: false}' --full-refresh --target "$db"
26+
dbt run --vars '{salesforce_marketing_cloud_schema: sfmc_sqlw_tests, salesforce_marketing_cloud__link_enabled: false, salesforce_marketing_cloud__list_enabled: false}' --target "$db"
27+
dbt test --vars '{salesforce_marketing_cloud_schema: sfmc_sqlw_tests}' --target "$db"
28+
else
1929
dbt seed --target "$db" --full-refresh
2030
dbt run --target "$db" --full-refresh
2131
dbt test --target "$db"
2232
dbt run --target "$db"
2333
dbt test --target "$db"
2434
dbt run --vars '{salesforce_marketing_cloud__link_enabled: false, salesforce_marketing_cloud__list_enabled: false}' --full-refresh --target "$db"
35+
dbt run --vars '{salesforce_marketing_cloud__link_enabled: false, salesforce_marketing_cloud__list_enabled: false}' --target "$db"
2536
dbt test --target "$db"
26-
37+
fi
2738
dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# dbt_salesforce_marketing_cloud v0.2.0
2+
3+
[PR #4](https://github.com/fivetran/dbt_salesforce_marketing_cloud/pull/4) includes the following updates. Please be aware these changes only impact Databricks warehouse users:
4+
5+
## 🚨 Breaking Changes 🚨
6+
> ⚠️ Since the following changes result in the table format changing for Databricks users, we recommend running a `--full-refresh` after upgrading to this version to avoid possible incremental failures.
7+
- For Databricks All-Purpose clusters, the `salesforce_marketing_cloud__events_enhanced` model will now be materialized using the delta table format (previously parquet).
8+
- Delta tables are generally more performant than parquet and are also more widely available for Databricks users. Previously, the parquet file format was causing compilation issues on customers' managed tables.
9+
10+
## Documentation
11+
- Added details to the README to highlight the incremental strategies used within the `salesforce_marketing_cloud__events_enhanced` model.
12+
13+
## Under the Hood
14+
- The `is_incremental_compatible` macro has been added to the package. This macro will return `true` if the Databricks runtime being used is an all-purpose cluster **or** if any other non-Databricks supported destination is being used.
15+
- This update was applied as there are other Databricks runtimes (ie. sql warehouse, endpoint, and external runtime) which do not support the `insert_overwrite` incremental strategy used in the `salesforce_marketing_cloud__events_enhanced` model.
16+
- In addition to the above, for Databricks users the `salesforce_marketing_cloud__events_enhanced` model will now leverage the incremental strategy only if the Databricks runtime is all-purpose. Otherwise, all other Databricks runtimes will not leverage an incremental strategy.
17+
- Added validation tests to the `integration_tests` folder to ensure the consistency and integrity of the `salesforce_marketing_cloud__events_enhanced` model for subsequent updates.
18+
119
# dbt_salesforce_marketing_cloud v0.1.0
220
🎉 This is the initial release of this package! 🎉
321

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,24 @@ dispatch:
5656
search_order: ['spark_utils', 'dbt_utils']
5757
```
5858
59+
### Database Incremental Strategies
60+
The `salesforce_marketing_cloud__events_enhanced` model in this package is materialized incrementally and is configured to work with the different strategies available to each supported warehouse.
61+
62+
For **BigQuery** and **Databricks All-Purpose Cluster runtime** destinations, we have chosen `insert_overwrite` as the default strategy, which benefits from the partitioning capability.
63+
> For all other Databricks runtimes, models are materialized as tables without support for incremental runs.
64+
65+
For **Snowflake**, **Redshift**, and **Postgres** databases, we have chosen `delete+insert` as the default strategy.
66+
67+
> Regardless of strategy, we recommend that users periodically run a `--full-refresh` to ensure a high level of data quality.
68+
5969
## Step 2: Install the package
6070
Include the following Salesforce Marketing Cloud package version in your `packages.yml` file:
6171
> [!TIP]
6272
> 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.
6373
```yml
6474
packages:
6575
- package: fivetran/salesforce_marketing_cloud
66-
version: [">=0.1.0", "<0.2.0"] # we recommend using ranges to capture non-breaking changes automatically
76+
version: [">=0.2.0", "<0.3.0"] # we recommend using ranges to capture non-breaking changes automatically
6777
```
6878

6979
## Step 3: Define database and schema variables

dbt_project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
config-version: 2
22
name: 'salesforce_marketing_cloud'
3-
version: '0.1.0'
3+
version: '0.2.0'
44
require-dbt-version: [">=1.3.0", "<2.0.0"]
55

66
models:

docs/catalog.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)