Skip to content

Commit b80753d

Browse files
Merge pull request #52 from fivetran/MagicBot/add-union-schema
Feature: Union schema compatibility
2 parents 69ef767 + 6dd24dd commit b80753d

20 files changed

+104
-51
lines changed

.buildkite/hooks/pre-command

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ export CI_SNOWFLAKE_DBT_USER=$(gcloud secrets versions access latest --secret="C
2121
export CI_SNOWFLAKE_DBT_WAREHOUSE=$(gcloud secrets versions access latest --secret="CI_SNOWFLAKE_DBT_WAREHOUSE" --project="dbt-package-testing-363917")
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")
24-
export CI_DATABRICKS_DBT_TOKEN=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_TOKEN" --project="dbt-package-testing-363917")
24+
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")

.buildkite/pipeline.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,6 @@ steps:
6969
- "CI_DATABRICKS_DBT_HOST"
7070
- "CI_DATABRICKS_DBT_HTTP_PATH"
7171
- "CI_DATABRICKS_DBT_TOKEN"
72+
- "CI_DATABRICKS_DBT_CATALOG"
7273
commands: |
7374
bash .buildkite/scripts/run_models.sh databricks

CHANGELOG.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
# dbt_google_ads v0.x.x
2-
3-
[PR #58](https://github.com/fivetran/dbt_google_ads/pull/58) includes the following updates:
4-
## Under the Hood:
5-
- Updates the [DECISIONLOG](DECISIONLOG.md) to clarify why there exist differences among aggregations across different grains.
1+
# dbt_google_ads v0.10.0
2+
[PR #52](https://github.com/fivetran/dbt_google_ads/pull/52) includes the following updates:
3+
## Feature update 🎉
4+
- Unioning capability! This adds the ability to union source data from multiple google_ads connectors. Refer to the [Union Multiple Connectors README section](https://github.com/fivetran/dbt_google_ads/blob/main/README.md#union-multiple-connectors) for more details.
5+
6+
## Under the Hood 🚘
7+
- In the source package, updated tmp models to union source data using the `fivetran_utils.union_data` macro.
8+
- To distinguish which source each field comes from, added `source_relation` column in each staging and downstream model and applied the `fivetran_utils.source_relation` macro.
9+
- The `source_relation` column is included in all joins in the transform package.
10+
- Updated tests to account for the new `source_relation` column.
11+
12+
[PR #60](https://github.com/fivetran/dbt_google_ads/pull/60) includes the following update:
13+
## Dependency Updates
14+
- Removes the dependency on `dbt-expectations`. Upstream we specifically removed the `dbt_expectations.expect_column_values_to_not_match_regex_list` test.
15+
## Under the Hood
16+
- Updates the [DECISIONLOG](DECISIONLOG.md) to clarify why there exist differences among aggregations across different grains.
617

718
# dbt_google_ads v0.9.3
819
[PR #57](https://github.com/fivetran/dbt_google_ads/pull/57) includes the following updates:

README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,11 @@ To use this dbt package, you must have the following:
3939
- A **BigQuery**, **Snowflake**, **Redshift**, **PostgreSQL**, or **Databricks** destination.
4040

4141
### Databricks Dispatch Configuration
42-
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` as well as the `calogica/dbt_expectations` then the `google_ads_source` packages respectively.
42+
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`.
4343
```yml
4444
dispatch:
4545
- macro_namespace: dbt_utils
4646
search_order: ['spark_utils', 'dbt_utils']
47-
48-
- macro_namespace: dbt_expectations
49-
search_order: ['google_ads_source', 'dbt_expectations']
5047
```
5148
5249
## Step 2: Install the package
@@ -55,7 +52,7 @@ Include the following google_ads package version in your `packages.yml` file:
5552
```yaml
5653
packages:
5754
- package: fivetran/google_ads
58-
version: [">=0.9.0", "<0.10.0"] # we recommend using ranges to capture non-breaking changes automatically
55+
version: [">=0.10.0", "<0.11.0"] # we recommend using ranges to capture non-breaking changes automatically
5956
```
6057
Do **NOT** include the `google_ads_source` package in this file. The transformation package itself has a dependency on it and will install the source package as well.
6158

@@ -70,7 +67,17 @@ vars:
7067

7168
## (Optional) Step 4: Additional configurations
7269

73-
<details><summary>Expand for configurations</summary>
70+
### Union multiple connectors
71+
If you have multiple google_ads connectors in Fivetran and would like to use this package on all of them simultaneously, we have provided functionality to do so. The package will union all of the data together and pass the unioned table into the transformations. You will be able to see which source it came from in the `source_relation` column of each model. To use this functionality, you will need to set either the `google_ads_union_schemas` OR `google_ads_union_databases` variables (cannot do both) in your root `dbt_project.yml` file:
72+
73+
```yml
74+
vars:
75+
google_ads_union_schemas: ['google_ads_usa','google_ads_canada'] # use this if the data is in different schemas/datasets of the same database/project
76+
google_ads_union_databases: ['google_ads_usa','google_ads_canada'] # use this if the data is in different databases/projects but uses the same schema name
77+
```
78+
Please be aware that the native `source.yml` connection set up in the package will not function when the union schema/database feature is utilized. Although the data will be correctly combined, you will not observe the sources linked to the package models in the Directed Acyclic Graph (DAG). This happens because the package includes only one defined `source.yml`.
79+
80+
To connect your multiple schema/database sources to the package models, follow the steps outlined in the [Union Data Defined Sources Configuration](https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source) section of the Fivetran Utils documentation for the union_data macro. This will ensure a proper configuration and correct visualization of connections in the DAG.
7481

7582
### Adding passthrough metrics
7683
By default, this package will select `clicks`, `impressions`, and `cost` from the source reporting tables to store into the staging models. If you would like to pass through additional metrics to the staging models, add the below configurations to your `dbt_project.yml` file. These variables allow for the pass-through fields to be aliased (`alias`) if desired, but not required. Use the below format for declaring the respective pass-through variables:
@@ -121,8 +128,6 @@ vars:
121128
google_ads_<default_source_table_name>_identifier: your_table_name
122129
```
123130

124-
</details>
125-
126131
## (Optional) Step 5: Orchestrate your models with Fivetran Transformations for dbt Core™
127132
<details><summary>Expand for more details</summary>
128133

@@ -137,7 +142,7 @@ This dbt package is dependent on the following dbt packages. Please be aware tha
137142
```yml
138143
packages:
139144
- package: fivetran/google_ads_source
140-
version: [">=0.9.0", "<0.10.0"]
145+
version: [">=0.10.0", "<0.11.0"]
141146
142147
- package: fivetran/fivetran_utils
143148
version: [">=0.4.0", "<0.5.0"]
@@ -147,12 +152,6 @@ packages:
147152
148153
- package: dbt-labs/spark_utils
149154
version: [">=0.3.0", "<0.4.0"]
150-
151-
- package: calogica/dbt_expectations
152-
version: [">=0.8.0", "<0.9.0"]
153-
154-
- package: calogica/dbt_date
155-
version: [">=0.7.0", "<0.8.0"]
156155
```
157156
# 🙌 How is this package maintained and can I contribute?
158157
## Package Maintenance

dbt_project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'google_ads'
2-
version: '0.9.3'
2+
version: '0.10.0'
33

44
config-version: 2
55
require-dbt-version: [">=1.3.0", "<2.0.0"]

docs/catalog.json

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

docs/index.html

Lines changed: 12 additions & 12 deletions
Large diffs are not rendered by default.

docs/manifest.json

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

docs/run_results.json

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

integration_tests/ci/sample.profiles.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ integration_tests:
4444
schema: google_ads_integration_tests_31
4545
threads: 8
4646
databricks:
47-
catalog: null
47+
catalog: "{{ env_var('CI_DATABRICKS_DBT_CATALOG') }}"
4848
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
4949
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
5050
schema: google_ads_integration_tests_31
51-
threads: 2
51+
threads: 8
5252
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
5353
type: databricks

0 commit comments

Comments
 (0)