Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fivetran/dbt_ad_reporting
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.5.0
Choose a base ref
...
head repository: fivetran/dbt_ad_reporting
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.6.0
Choose a head ref
  • 18 commits
  • 9 files changed
  • 2 contributors

Commits on Jul 21, 2023

  1. update metrics spec

    Jstein77 committed Jul 21, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    37af267 View commit details
  2. update CHANGELOG

    Jstein77 committed Jul 21, 2023
    Copy the full SHA
    5895613 View commit details
  3. remove profile

    Jstein77 committed Jul 21, 2023
    Copy the full SHA
    b8d1cc2 View commit details

Commits on Jul 27, 2023

  1. delete time spine model

    Jstein77 committed Jul 27, 2023
    Copy the full SHA
    43df964 View commit details

Commits on Aug 3, 2023

  1. update spec for 1.6

    Jstein77 committed Aug 3, 2023
    Copy the full SHA
    2e4d647 View commit details

Commits on Aug 7, 2023

  1. Copy the full SHA
    5cd5372 View commit details

Commits on Aug 8, 2023

  1. Copy the full SHA
    704146a View commit details
  2. Copy the full SHA
    3c7389e View commit details
  3. Copy the full SHA
    f60b920 View commit details

Commits on Aug 9, 2023

  1. Copy the full SHA
    22398c8 View commit details
  2. Copy the full SHA
    4c264e7 View commit details
  3. enabled

    fivetran-joemarkiewicz committed Aug 9, 2023
    Copy the full SHA
    779e47c View commit details
  4. Copy the full SHA
    b531920 View commit details
  5. Copy the full SHA
    2a821d7 View commit details
  6. Copy the full SHA
    8c826a7 View commit details
  7. Copy the full SHA
    dbd2517 View commit details

Commits on Aug 10, 2023

  1. review updates

    fivetran-joemarkiewicz committed Aug 10, 2023
    Copy the full SHA
    ce2d939 View commit details
  2. Copy the full SHA
    a8c6acc View commit details
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -3,5 +3,5 @@ target/
dbt_modules/
logs/
.DS_Store

venv
dbt_packages/
34 changes: 33 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@

# dbt_ad_reporting v1.6.0
[PR #100](https://github.com/fivetran/dbt_ad_reporting/pull/100) includes the following updates.

## 🚨 New dbt-core version requirement 🚨
- Updated the metrics spec to reflect the new spec in dbt-core 1.6.0. As a result, the new required dbt version is `[">=1.6.0", "<2.0.0"]`. Be sure to upgrade your dbt-core version when upgrading this package to avoid dbt version compatibility errors.

## Feature Updates
- Added `ad_reporting__ad_report.yml` semantic model which is required to define metrics.
- Included `metricflow_time_spine.sql` which is required by Metricflow. This will be deprecated in future releases. If you have already created a `metricflow_time_spine.sql` model in your project, you will need to disable it for this package by setting the variable `ad_reporting__metricflow_time_spine_enabled` to `false` in your project.

```yml
## root dbt_project.yml
vars:
ad_reporting__metricflow_time_spine_enabled: false ## true by default
```
## Under the Hood
- Added a new variable `dbt_date:time_zone` which is used by the `dbt_date.get_base_dates` macro within the `metricflow_time_spine` model. This variable is nested under the `ad_reporting` hierarchy in the variables config and should not affect any global declarations if you leverage the `dbt_date` package in your own environment.
- The default value of this variable is `America/Los_Angeles`, but you may be able override this in your own root project. For more information on why this variable is needed and the different value options, refer to the [dbt-date package documentation](https://github.com/calogica/dbt-date#variables).

```yml
## root dbt_project.yml
vars:
"dbt_date:time_zone": "America/Chicago" # Default is "America/Los_Angeles"
```

## Documentation
- Please be aware that due to a bug in dbt-core v1.6.0 the docs were not regenerated as part of this release. You can expect a new release in the future with the regenerated docs that contain these updates.

## Contributors
- [@Jstein77](https://github.com/Jstein77) ([PR #100](https://github.com/fivetran/dbt_ad_reporting/pull/100))

# dbt_ad_reporting v1.5.0

## 🚨 Breaking Changes 🚨
@@ -14,7 +47,6 @@
- [@aleix-cd](https://github.com/aleix-cd) ([PR #96](https://github.com/fivetran/dbt_ad_reporting/pull/96))

# dbt_ad_reporting v1.4.0

## 🎉 Feature Enhancement 🎉
- Added `ad_reporting__<report>_passthrough_metrics` variables to easily add common metrics across all platforms into the `ad_reporting` models! This allows metrics other than the standard `clicks`, `impressions`, and `cost` to be included in the final ad reporting models. See below for a full list of new variables and example metrics to passthrough. ([PR #85](https://github.com/fivetran/dbt_ad_reporting/pull/84))
- It is important to call out that this is only possible if the relevant upstream Ad platform variables have the same metric to be unioned in the roll up model. Please see the [README](https://github.com/fivetran/dbt_ad_reporting#optional-step-6-additional-configurations) section for details around how to configure the passthrough metrics.
54 changes: 29 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
href="https://github.com/fivetran/dbt_github/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.3.0_<2.0.0-orange.svg" /></a>
<img src="https://img.shields.io/badge/dbt_Core™_version->=1.6.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">
@@ -77,7 +77,7 @@ Include the following github package version in your `packages.yml`
```yaml
packages:
- package: fivetran/ad_reporting
version: [">=1.5.0", "<1.6.0"] # we recommend using ranges to capture non-breaking changes automatically
version: [">=1.6.0", "<1.7.0"] # we recommend using ranges to capture non-breaking changes automatically
```

Do NOT include the individual ad platform packages in this file. The ad reporting package itself has dependencies on these packages and will install them as well.
@@ -461,10 +461,10 @@ Fivetran offers the ability for you to orchestrate your dbt project through [Fiv
</details>
<br>

## (Optional) Step 8: Use predefined Metrics
## (Optional) Step 8: Use predefined Metrics and the dbt Semantic Layer
<details><summary>Expand for details</summary>

On top of the `ad_reporting__ad_report` final model, the Ad Reporting dbt package defines common [Metrics](https://docs.getdbt.com/docs/building-a-dbt-project/metrics), including:
On top of the `ad_reporting__ad_report` final model, the Ad Reporting dbt package defines common [Metrics](https://docs.getdbt.com/docs/build/build-metrics-intro) using [MetricFlow](https://docs.getdbt.com/docs/build/about-metricflow) that can be queried with the [dbt Semantic Layer](https://docs.getdbt.com/docs/use-dbt-semantic-layer/dbt-sl). These metrics include:
- Spend
- Impressions
- Clicks
@@ -475,29 +475,33 @@ On top of the `ad_reporting__ad_report` final model, the Ad Reporting dbt packag
- Average spend
- Average non-zero spend

You can find the supported dimensions and full definitions of these metrics [here](https://github.com/fivetran/dbt_ad_reporting/blob/main/models/ad_reporting_metrics.yml).

To use dbt Metrics, please refer to the [dbt metrics package](https://github.com/dbt-labs/dbt_metrics) and install the relevant version to your project's `packages.yml` file.

> **Note**: The Metrics package has stricter dbt version requirements, therefore, please take note of the correct dbt version for your desired version of dbt Metrics.

To utilize the Ad Reporting's pre-defined metrics in your code, refer to the [dbt metrics package](https://github.com/dbt-labs/dbt_metrics) usage instructions and the example below:
```sql
select *
from {{ metrics.calculate(
metric('clicks'),
grain='month',
dimensions=['platform',
'campaign_id',
'campaign_name'
],
secondary_calculations=[
metrics.period_over_period(comparison_strategy='difference', interval=1, alias='diff_last_mth'),
metrics.period_over_period(comparison_strategy='ratio', interval=1, alias='ratio_last_mth')
]
) }}
You can find the supported dimensions and full definitions of these metrics [here](https://github.com/fivetran/dbt_ad_reporting/blob/main/models/ad_reporting_metrics.yml), and the semantic model definitions [here](https://github.com/fivetran/dbt_ad_reporting/blob/main/models/metrics/models/semantic_models/ad_reporting__ad_report.yaml).

Refer to the Semantic Layer [quickstart guide](https://docs.getdbt.com/docs/use-dbt-semantic-layer/quickstart-sl) for instructions on how to get setup with the dbt Semantic Layer and start querying these metrics.

**Metricflow Time Spine Configuration**
This package includes a model called `metricflow_time_spine.sql` that MetricFlow requires to build cumulative metrics. Documentation on the metricflow time spine model can be [found here.](https://docs.getdbt.com/docs/build/metricflow-time-spine) If you have already configured a metricflow time spine model in your project, you will need to disable the one in this package by defining the `ad_reporting__metricflow_time_spine_enabled` variable as `false` in your project.

```yml
## root dbt_project.yml
vars:
ad_reporting__metricflow_time_spine_enabled: false ## true by default
```
Additionally, the `dbt_date.get_base_dates` macro is used in the generation of the `metricsflow_time_spine.sql` model. This macro requires the `dbt_date:time_zone` variable to be defined in the project to generate a time spine based on the defined time zone. The default value in this package is `America/Los_Angeles`. However, you may override this variable in your own project if you wish.

>**Note**: This variable is defined under the `ad_reporting` hierarchy within this package and should not adjust any local global variable values in your project if you already have this variable defined. For more information on why this variable is needed and the different value options, refer to the [dbt-date package documentation](https://github.com/calogica/dbt-date#variables).

```yml
## root dbt_project.yml
vars:
"dbt_date:time_zone": "America/Chicago" # Default is "America/Los_Angeles"
```

**Semantic Manifest**
You may notice a new run artifact called `semantic_manifest.json`. This file serves as the integation point between dbt-core and metricflow, and contains all the information MetricFlow needs to build a semantic graph, and generate SQL from query requests. You can learn more about the semantic manifest file [in the docs](https://docs.getdbt.com/docs/dbt-cloud-apis/sl-manifest).

> **Note**: Metricflow is only supported in dbt>=v1.6.0, therefore, please take note of the correct dbt version.

</details>
<br>

5 changes: 3 additions & 2 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: 'ad_reporting'
version: '1.5.0'
version: '1.6.0'

config-version: 2

require-dbt-version: [">=1.3.0", "<2.0.0"]
require-dbt-version: [">=1.6.0", "<2.0.0"]

vars:
ad_reporting:
@@ -13,6 +13,7 @@ vars:
ad_reporting__ad_passthrough_metrics: []
ad_reporting__keyword_passthrough_metrics: []
ad_reporting__search_passthrough_metrics: []
"dbt_date:time_zone": "America/Los_Angeles"

models:
ad_reporting:
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'ad_reporting_integration_tests'
version: '1.5.0'
version: '1.6.0'
profile: 'integration_tests'
config-version: 2

201 changes: 0 additions & 201 deletions models/ad_reporting_metrics.yml

This file was deleted.

Loading