Skip to content

Commit

Permalink
Fix/update ad account id test severity (#110)
Browse files Browse the repository at this point in the history
* apply snapchat change to ad reporting

* document

* updates

* decision log
  • Loading branch information
fivetran-jamie authored Apr 30, 2024
1 parent 76179e5 commit f880560
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .buildkite/scripts/run_models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ echo `pwd`
cd integration_tests
dbt deps
dbt seed --target "$db" --full-refresh
dbt run --target "$db" --full-refresh --vars '{ad_reporting__facebook_ads_enabled: true, ad_reporting__google_ads_enabled: true, ad_reporting__amazon_ads_enabled: true, ad_reporting__apple_search_ads_enabled: false, ad_reporting__linkedin_ads_enabled: false, ad_reporting__microsoft_ads_enabled: true, ad_reporting__pinterest_ads_enabled: true, ad_reporting__reddit_ads_enabled: false, ad_reporting__snapchat_ads_enabled: false, ad_reporting__tiktok_ads_enabled: true, ad_reporting__twitter_ads_enabled: true}'
dbt test --target "$db" --vars '{ad_reporting__facebook_ads_enabled: true, ad_reporting__google_ads_enabled: true, ad_reporting__amazon_ads_enabled: true, ad_reporting__apple_search_ads_enabled: false, ad_reporting__linkedin_ads_enabled: false, ad_reporting__microsoft_ads_enabled: true, ad_reporting__pinterest_ads_enabled: true, ad_reporting__reddit_ads_enabled: false, ad_reporting__snapchat_ads_enabled: false, ad_reporting__tiktok_ads_enabled: true, ad_reporting__twitter_ads_enabled: true}'
dbt run --target "$db" --full-refresh --vars '{ad_reporting__facebook_ads_enabled: true, ad_reporting__google_ads_enabled: true, ad_reporting__amazon_ads_enabled: false, ad_reporting__apple_search_ads_enabled: false, ad_reporting__linkedin_ads_enabled: false, ad_reporting__microsoft_ads_enabled: false, ad_reporting__pinterest_ads_enabled: false, ad_reporting__reddit_ads_enabled: false, ad_reporting__snapchat_ads_enabled: true, ad_reporting__tiktok_ads_enabled: false, ad_reporting__twitter_ads_enabled: false}'
dbt test --target "$db" --vars '{ad_reporting__facebook_ads_enabled: true, ad_reporting__google_ads_enabled: true, ad_reporting__amazon_ads_enabled: false, ad_reporting__apple_search_ads_enabled: false, ad_reporting__linkedin_ads_enabled: false, ad_reporting__microsoft_ads_enabled: false, ad_reporting__pinterest_ads_enabled: false, ad_reporting__reddit_ads_enabled: false, ad_reporting__snapchat_ads_enabled: true, ad_reporting__tiktok_ads_enabled: false, ad_reporting__twitter_ads_enabled: false}'

dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"
49 changes: 14 additions & 35 deletions .github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,33 @@
**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
- [ ] 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.
<!--- 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)

### ❗ Special Updates for Ad Reporting ❗
#### ❗ Special Updates for Ad Reporting ❗
To reduce integration testing time, not all models should be enabled in the `run_models.sh` vars. Update the variables after `dbt run` and `dbt test` to set:
- [ ] this PR's package to `true`
- [ ] Google Ads and Facebook Ads to `true` (if not already)
- [ ] All other packages to `false`

### 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)
### Detailed Validation
Please share any and all of your validation steps:
<!--- Provide the steps you took to validate your changes below. -->

### 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:
:dancer:
13 changes: 13 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'auto release'
on:
pull_request:
types:
- closed
branches:
- main

jobs:
call-workflow-passing-data:
if: github.event.pull_request.merged
uses: fivetran/dbt_package_automations/.github/workflows/auto-release.yml@main
secrets: inherit
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# dbt_ad_reporting v1.7.1
## Bug Fixes
- Adjust the severity of the `account_id` test in `ad_reporting__account_report` to `warn`. This is required since Snapchat can hard-delete records from the history tables, but not from the reporting tables. This ensures that accurate statistics are being reported and production pipelines aren't failing. ([PR #20](https://github.com/fivetran/dbt_snapchat_ads/pull/20))
- Documents the above decision in the [DECISIONLOG.md](https://github.com/fivetran/dbt_ad_reporting/blob/main/DECISIONLOG.md).

## Under the Hood
- Updated the pull request [templates](/.github) ([PR #110](https://github.com/fivetran/dbt_ad_reporting/pull/110)).
- Included auto-releaser GitHub Actions workflow to automate future releases ([PR #110](https://github.com/fivetran/dbt_ad_reporting/pull/110)).

## Contributors
- [@bthomson22](https://github.com/bthomson22) ([PR #20](https://github.com/fivetran/dbt_snapchat_ads/pull/20))

# dbt_ad_reporting v1.7.0
[PR #103](https://github.com/fivetran/dbt_ad_reporting/pull/103) includes the following update.

Expand Down
19 changes: 18 additions & 1 deletion DECISIONLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,22 @@ Account
└── Keyword
```
Where Account > Campaign > Ad Group > Ad and Search and Keyword reports are created at the Ad Group Level. Depending on the platform, URL reports can be at the Ad Level or the Ad Group level so we have made the decision to provide only reporting at the Ad Group level to be inclusive of all our platforms.

### Linkedin Campaign Group and Campaign Mapping
Linkedin's "campaign group" reporting is the equivalent to all other platforms' "campaign" reporting; similarly, Linkedin's "campaign" reporting is equivalent to all other platforms' "ad group" reporting. Therefore, the Ad Reporting campaign model and ad group model each reflect the proper roll up for Linkedin with respects to other platforms.
Linkedin's "campaign group" reporting is the equivalent to all other platforms' "campaign" reporting; similarly, Linkedin's "campaign" reporting is equivalent to all other platforms' "ad group" reporting. Therefore, the Ad Reporting campaign model and ad group model each reflect the proper roll up for Linkedin with respects to other platforms.

### Snapchat Ad Account Report Metrics Associated with Deleted Entities
Snapchat Ads will hard-delete entities (i.e. ads, ad squads, campaigns, accounts) from their `*_history` tables but retain associated records in their respective `*_hourly_report` tables. This typically does not pose an issue for our `not_null` tests on our Ad Reporting and Snapchat Ads end models, as most entities have their own `<entity>_hourly_report` source tables that come with the appropriate entity-level ID. However, `snapchat_ads__account_report` (and the downstream `ad_reporting__account_report` model) draws from the Snapchat `ad_hourly_report` table, rolls it up to the account level, and joins in the ad `account_id` using history tables. Thus, if any ad report record is associated with a deleted ad, campaign, ad squad, or account, the ad `account_id` will be `null`.

We have opted to keep these records in `snapchat_ads__account_report` and `ad_reporting__account_report`, as it may be valuable to know that non-zero ad metrics are associated with deleted entities (though null-account Snapchat records will be grouped together). However, we have changed the severity of the `not_null` test on ad `account_id` to be `warn` instead of `error`.

If you would like to disable this `not_null` test completely to avoid warnings, add the following to your root project `dbt_project.yml`:
```yml
tests:
snapchat_ads:
not_null_snapchat_ads__account_report_ad_account_id:
+enabled: false
ad_reporting:
not_null_ad_reporting__account_report_account_id:
+enabled: false
```
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'ad_reporting'
version: '1.7.0'
version: '1.7.1'

config-version: 2

Expand Down
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.7.0'
version: '1.7.1'
profile: 'integration_tests'
config-version: 2

Expand Down
4 changes: 3 additions & 1 deletion models/ad_reporting_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ models:
- name: account_id
description: '{{ doc("account_id") }}'
tests:
- not_null
- not_null:
config:
severity: warn
- name: account_name
description: '{{ doc("account_name") }}'
- name: clicks
Expand Down

0 comments on commit f880560

Please sign in to comment.