Skip to content

Commit

Permalink
validations (#32)
Browse files Browse the repository at this point in the history
* validations

* polishes

* docs

* changelog

* changelog

* package dep update

* catherine feedback
  • Loading branch information
fivetran-jamie committed Jul 15, 2024
1 parent 3a7a998 commit 36e7d9e
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 47 deletions.
43 changes: 11 additions & 32 deletions .github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,27 @@
**This PR will result in the following new package version:**
<!--- Please add details around your decision for breaking vs non-breaking version upgrade. If this is a breaking change, were backwards-compatible options explored? -->

**Please detail what change(s) this PR introduces and any additional information that should be known during the review of this PR:**
**Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:**
<!--- Copy/paste the CHANGELOG for this version below. -->

## PR Checklist
### Basic Validation
Please acknowledge that you have successfully performed the following commands locally:
- [ ] dbt compile
- [ ] dbt run –full-refresh
- [ ] dbt run
- [ ] dbt test
- [ ] dbt run –vars (if applicable)
- [ ] dbt run –full-refresh && dbt test
- [ ] dbt run (if incremental models are present) && dbt test

Before marking this PR as "ready for review" the following have been applied:
- [ ] The appropriate issue has been linked and tagged
- [ ] You are assigned to the corresponding issue and this PR
- [ ] BuildKite integration tests are passing
- [ ] The appropriate issue has been linked, tagged, and properly assigned.
- [ ] All necessary documentation and version upgrades have been applied.
<!--- Be sure to update the package version in the dbt_project.yml, integration_tests/dbt_project.yml, and README if necessary. -->
- [ ] docs were regenerated (unless this PR does not include any code or yml updates).
- [ ] BuildKite integration tests are passing.
- [ ] Detailed validation steps have been provided below.

### Detailed Validation
Please acknowledge that the following validation checks have been performed prior to marking this PR as "ready for review":
- [ ] You have validated these changes and assure this PR will address the respective Issue/Feature.
- [ ] You are reasonably confident these changes will not impact any other components of this package or any dependent packages.
- [ ] You have provided details below around the validation steps performed to gain confidence in these changes.
Please share any and all of your validation steps:
<!--- Provide the steps you took to validate your changes below. -->

### Standard Updates
Please acknowledge that your PR contains the following standard updates:
- Package versioning has been appropriately indexed in the following locations:
- [ ] indexed within dbt_project.yml
- [ ] indexed within integration_tests/dbt_project.yml
- [ ] CHANGELOG has individual entries for each respective change in this PR
<!--- If there is a parallel upstream change, remember to reference the corresponding CHANGELOG as an individual entry. -->
- [ ] README updates have been applied (if applicable)
<!--- Remember to check the following README locations for common updates. →
<!--- Suggested install range (needed for breaking changes) →
<!--- Dependency matrix is appropriately updated (if applicable) →
<!--- New variable documentation (if applicable) -->
- [ ] DECISIONLOG updates have been updated (if applicable)
- [ ] Appropriate yml documentation has been added (if applicable)

### dbt Docs
Please acknowledge that after the above were all completed the below were applied to your branch:
- [ ] docs were regenerated (unless this PR does not include any code or yml updates)

### If you had to summarize this PR in an emoji, which would it be?
<!--- For a complete list of markdown compatible emojis check our this git repo (https://gist.github.com/rxaviers/7360908) -->
:dancer:
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# dbt_microsoft_ads v0.8.0

[PR #32](https://github.com/fivetran/dbt_microsoft_ads/pull/32) includes the following updates:

## Under the Hood
- Updated the PR Templates for package maintainers to our most up-to-date standards.
- Added consistency validation test for the `microsoft_ads__campaign_report` table (to be used only by maintainers).

## Parallel Upstream Source Package [Release](https://github.com/fivetran/dbt_microsoft_ads_source/releases/tag/v0.9.0)
This includes upstream updates made in dbt_microsoft_ads_source [PR #31](https://github.com/fivetran/dbt_microsoft_ads_source/pull/31):

### Bug Fixes
- Accommodates when the `budget_name` and `budget_status` fields are populated within the `CAMPAIGN_PERFORMANCE_DAILY_REPORT` source table. These fields are now:
- Included and documented in the `stg_microsoft_ads__campaign_daily_report` model.
- Included in uniqueness tests on `stg_microsoft_ads__campaign_daily_report`, as they affect the grain of the report and may have therefore induced uniqueness test failures.
- Added proper documentation for the pre-existing `budget_association_status` field (also from `CAMPAIGN_PERFORMANCE_DAILY_REPORT`).

# dbt_microsoft_ads v0.7.1

[PR #30](https://github.com/fivetran/dbt_microsoft_ads/pull/30) includes the following updates:
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ dispatch:
search_order: ['spark_utils', 'dbt_utils']
```
## Step 2: Install the package
Include the following microsoft_ads package version in your `packages.yml` file:
## Step 2: Install the package (skip if using Ad Reporting combo package)
If you are NOT using the [Ad Reporting combination package](https://github.com/fivetran/dbt_ad_reporting), include the following microsoft_ads 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/microsoft_ads
version: [">=0.7.0", "<0.8.0"]
version: [">=0.8.0", "<0.9.0"]
```

## Step 3: Define database and schema variables
By default, this package runs using your destination and the `microsoft_ads` schema. If this is not where your Microsoft Ads data is (for example, if your Microsoft Ads schema is named `microsoft_ads_fivetran`), add the following configuration to your root `dbt_project.yml` file:

Expand Down Expand Up @@ -127,7 +128,7 @@ models:
```

### Change the source table references
If 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:
If 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. This is not available if you are unioning together multiple connectors.

> IMPORTANT: See this project's [`dbt_project.yml`](https://github.com/fivetran/dbt_microsoft_ads/blob/main/dbt_project.yml) variable declarations to see the expected names.

Expand All @@ -136,7 +137,7 @@ vars:
microsoft_ads_<default_source_table_name>_identifier: your_table_name
```

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

Fivetran 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).
Expand All @@ -150,7 +151,7 @@ This dbt package is dependent on the following dbt packages. Please be aware tha
```yml
packages:
- package: fivetran/microsoft_ads_source
version: [">=0.8.0", "<0.9.0"]
version: [">=0.9.0", "<0.10.0"]
- package: fivetran/fivetran_utils
version: [">=0.4.0", "<0.5.0"]
Expand All @@ -175,5 +176,4 @@ We highly encourage and welcome contributions to this package. Check out [this d

# 🏪 Are there any resources available?
- If you have questions or want to reach out for help, please refer to the [GitHub Issue](https://github.com/fivetran/dbt_microsoft_ads/issues/new/choose) section to find the right avenue of support for you.
- 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).
- Have questions or want to be part of the community discourse? Create a post in the [Fivetran community](https://community.fivetran.com/t5/user-group-for-dbt/gh-p/dbt-user-group) and our team along with the community can join in on the discussion!
- 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).
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'microsoft_ads'
version: '0.7.1'
version: '0.8.0'
config-version: 2
require-dbt-version: [">=1.3.0", "<2.0.0"]
vars:
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/run_results.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'microsoft_ads_integration_tests'
version: '0.7.1'
version: '0.8.0'
profile: 'integration_tests'
config-version: 2

Expand All @@ -17,6 +17,9 @@ vars:
microsoft_ads_keyword_performance_daily_report_identifier: "microsoft_ads_keyword_performance_daily_report_data"
microsoft_ads_search_query_performance_daily_report_identifier: "microsoft_ads_search_performance_daily_report_data"

models:
+schema: "microsoft_ads_{{ var('directed_schema','dev') }}"

seeds:
microsoft_ads_integration_tests:
+column_types:
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/packages.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
packages:
- local: ../
- local: ../
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{ config(
tags="fivetran_validations",
enabled=var('fivetran_validation_tests_enabled', false)
) }}

with prod as (
select
campaign_id,
sum(clicks) as clicks,
sum(impressions) as impressions,
sum(spend) as spend
from {{ target.schema }}_microsoft_ads_prod.microsoft_ads__campaign_report
group by 1
),

dev as (
select
campaign_id,
sum(clicks) as clicks,
sum(impressions) as impressions,
sum(spend) as spend
from {{ target.schema }}_microsoft_ads_dev.microsoft_ads__campaign_report
group by 1
),

final as (
select
prod.campaign_id,
prod.clicks as prod_clicks,
dev.clicks as dev_clicks,
prod.impressions as prod_impressions,
dev.impressions as dev_impressions,
prod.spend as prod_spend,
dev.spend as dev_spend
from prod
full outer join dev
on dev.campaign_id = prod.campaign_id
)

select *
from final
where
abs(prod_clicks - dev_clicks) >= .01
or abs(prod_impressions - dev_impressions) >= .01
or abs(prod_spend - dev_spend) >= .01
2 changes: 1 addition & 1 deletion packages.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
packages:
- package: fivetran/microsoft_ads_source
version: [">=0.8.0", "<0.9.0"]
version: [">=0.9.0", "<0.10.0"]

0 comments on commit 36e7d9e

Please sign in to comment.