Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5 API support #26

Merged
merged 21 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# dbt_pinterest v0.9.0

# Pinterest Ads v5 Upgrade
## 🚨 Breaking Changes 🚨:
[PR #26](https://github.com/fivetran/dbt_pinterest/pull/26) introduces the following changes:

- Following Pinterest Ads deprecating the v4 API on June 30, 2023 in place of v5, the Pinterest Ads Fivetran connector now leverages the Pinterest v5 API. The following fields have been deprecated/introduced:

| **Model** | **Removed** | **New** |
|---|---|---|
| [pinterest_ads__advertiser_report](https://fivetran.github.io/dbt_pinterest/#!/model/model.pinterest.pinterest_ads__advertiser_report) | `billing_type`, `status` | |

## Under the Hood:
- Following the v5 upgrade, `ad_account_id` is a net new field within `ad_group_history` and `pin_promotion_history` source tables synced via the connector. However, to keep these fields standard across the package, we have renamed them as `advertiser_id` within the respective staging models.
- Seed data were updated with new/removed fields following the v5 upgrade


# dbt_pinterest v0.8.0
- This was an accidental release

# dbt_pinterest v0.7.1
## Features
- Addition of the `pinterest__using_keywords` (default=`true`) variable that allows users to disable the relevant keyword reports in the downstream Pinterest models if they are not used. ([#25](https://github.com/fivetran/dbt_pinterest/pull/25))
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Include the following pinterest package version in your `packages.yml` file:
```yaml
packages:
- package: fivetran/pinterest
version: [">=0.7.0", "<0.8.0"] # we recommend using ranges to capture non-breaking changes automatically
version: [">=0.9.0", "<0.10.0"] # we recommend using ranges to capture non-breaking changes automatically
```

Do NOT include the `pinterest_source` package in this file. The transformation package itself has a dependency on it and will install the source package as well.
Expand Down Expand Up @@ -135,7 +135,7 @@ This dbt package is dependent on the following dbt packages. Please be aware tha
```yml
packages:
- package: fivetran/pinterest_source
version: [">=0.7.0", "<0.8.0"]
version: [">=0.9.0", "<0.10.0"]

- package: fivetran/fivetran_utils
version: [">=0.4.0", "<0.5.0"]
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'pinterest'
version: '0.7.1'
version: '0.9.0'
config-version: 2
require-dbt-version: [">=1.3.0", "<2.0.0"]
models:
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.

23 changes: 12 additions & 11 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: 'pinterest_integration_tests'
version: '0.7.1'
version: '0.9.0'
profile: 'integration_tests'
config-version: 2

vars:
pinterest_schema: pinterest_integration_tests_3
pinterest_ad_group_history_identifier: "ad_group_history_data"
pinterest_campaign_history_identifier: "campaign_history_data"
pinterest_pin_promotion_history_identifier: "pin_promotion_history_data"
pinterest_pin_promotion_report_identifier: "pin_promotion_report_data"
pinterest_keyword_history_identifier: "keyword_history_data"
pinterest_keyword_report_identifier: "keyword_report_data"
pinterest_ad_group_report_identifier: "ad_group_report_data"
pinterest_campaign_report_identifier: "campaign_report_data"
pinterest_advertiser_history_identifier: "advertiser_history_data"
pinterest_advertiser_report_identifier: "advertiser_report_data"
pinterest_ad_group_history_identifier: "pinterest_ad_group_history_data"
pinterest_campaign_history_identifier: "pinterest_campaign_history_data"
pinterest_pin_promotion_history_identifier: "pinterest_pin_promotion_history_data"
pinterest_pin_promotion_report_identifier: "pinterest_pin_promotion_report_data"
pinterest_keyword_history_identifier: "pinterest_keyword_history_data"
pinterest_keyword_report_identifier: "pinterest_keyword_report_data"
pinterest_ad_group_report_identifier: "pinterest_ad_group_report_data"
pinterest_campaign_report_identifier: "pinterest_campaign_report_data"
pinterest_advertiser_history_identifier: "pinterest_advertiser_history_data"
pinterest_advertiser_report_identifier: "pinterest_advertiser_report_data"

seeds:
+quote_columns: "{{ true if target.type in ('redshift','postgres') else false }}"
Expand All @@ -25,6 +25,7 @@ seeds:
ad_group_id: "{{ 'int64' if target.name == 'bigquery' else 'bigint' }}"
pin_id: "{{ 'int64' if target.name == 'bigquery' else 'bigint' }}"
campaign_id: "{{ 'int64' if target.name == 'bigquery' else 'bigint' }}"
ad_account_id: "{{ 'int64' if target.name == 'bigquery' else 'bigint' }}"
advertiser_id: "{{ 'int64' if target.name == 'bigquery' else 'bigint' }}"
pin_promotion_id: "{{ 'int64' if target.name == 'bigquery' else 'bigint' }}"
keyword_id: "{{ 'int64' if target.name == 'bigquery' else 'bigint' }}"
Expand Down
2 changes: 0 additions & 2 deletions integration_tests/seeds/campaign_history_data.csv

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
id,campaign_id,created_time,name,status,start_time,end_time,_fivetran_synced
2680065434898,626741793779,2020-03-26 09:38:46.000 +0000,9f8de0662581357b8af505197ad8145d,ACTIVE,2020-03-26 09:37:00.000 +0000,,2020-07-30 12:14:01.984 +0000
2680065434868,626741793779,2020-03-26 09:36:43.000 +0000,22a5457e096095c4e295a3c921db864c,ACTIVE,2020-03-26 09:36:00.000 +0000,,2020-07-30 12:14:01.246 +0000
2680065434863,626741793779,2020-03-26 09:35:49.000 +0000,5c7cdb607c2e540062914e276045d4d5,ACTIVE,2020-03-26 09:34:00.000 +0000,,2020-07-30 12:14:00.867 +0000
2680065434881,626741793779,2020-03-26 09:37:17.000 +0000,304b2dc4ed50ff5b6d714b810d8b50cf,ACTIVE,2020-03-26 09:36:00.000 +0000,,2020-07-30 12:14:01.598 +0000
id,campaign_id,created_time,name,status,start_time,end_time,_fivetran_synced,pacing_delivery_type,placement_group,summary_status,ad_account_id
2680065434898,626741793779,2020-03-26 09:38:46.000 +0000,9f8de0662581357b8af505197ad8145d,ACTIVE,2020-03-26 09:37:00.000 +0000,,2020-07-30 12:14:01.984 +0000,STANDARD,ALL,RUNNING,151515151
2680065434868,626741793779,2020-03-26 09:36:43.000 +0000,22a5457e096095c4e295a3c921db864c,ACTIVE,2020-03-26 09:36:00.000 +0000,,2020-07-30 12:14:01.246 +0000,STANDARD,SEARCH,RUNNING,151515151
2680065434863,626741793779,2020-03-26 09:35:49.000 +0000,5c7cdb607c2e540062914e276045d4d5,ACTIVE,2020-03-26 09:34:00.000 +0000,,2020-07-30 12:14:00.867 +0000,STANDARD,BROWSE,RUNNING,151515151
2680065434881,626741793779,2020-03-26 09:37:17.000 +0000,304b2dc4ed50ff5b6d714b810d8b50cf,ACTIVE,2020-03-26 09:36:00.000 +0000,,2020-07-30 12:14:01.598 +0000,STANDARD,OTHER,RUNNING,151515151
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
id,updated_time,_fivetran_synced,billing_profile_status,billing_type,country,created_time,currency,merchant_id,name,owner_user_id,status
549764253315,2022-06-07 14:43:17,2022-06-30 14:01:04,VALID,CASH_MONEY,US,2022-06-07 14:17:13,USD,,That Kitty Cat Company,1111111,ACTIVE
id,updated_time,_fivetran_synced,billing_profile_status,billing_type,country,created_time,currency,merchant_id,name,owner_user_id,status,owner_username,permissions
549764253315,2022-06-07 14:43:17,2022-06-30 14:01:04,VALID,CASH_MONEY,US,2022-06-07 14:17:13,USD,,That Kitty Cat Company,1111111,ACTIVE,username,string
2 changes: 2 additions & 0 deletions integration_tests/seeds/pinterest_campaign_history_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,created_time,name,status,_fivetran_synced,advertiser_id,default_ad_group_budget_in_micro_currency,is_automated_campaign,is_campaign_budget_optimization,is_flexible_daily_budgets
626741793779,2020-03-26 08:59:57.000 +0000,19e757f946601de26307d8182635b716,ACTIVE,2020-07-30 12:14:00.362 +0000,151515151,134,True,True,True
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
id,ad_group_id,created_time,destination_url,name,pin_id,status,creative_type,_fivetran_synced
687205395400,2680065434868,2020-03-26 09:36:43.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-05-28 06:14:04.150 +0000
687205395399,2680065434868,2020-03-26 09:36:43.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216220,ACTIVE,VIDEO,2020-06-15 18:14:18.130 +0000
687205395403,2680065434881,2020-03-26 09:37:17.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-01 12:14:37.616 +0000
687205395388,2680065434863,2020-03-26 09:35:49.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-23 12:14:01.610 +0000
687205395434,2680065434898,2020-03-26 09:38:46.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-24 00:14:18.647 +0000
687205395434,2680065434898,2020-03-26 09:38:46.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-30 12:14:03.098 +0000
687205395388,2680065434863,2020-03-26 09:35:49.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-30 12:14:03.093 +0000
687205395403,2680065434881,2020-03-26 09:37:17.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-30 12:14:03.096 +0000
687205395399,2680065434868,2020-03-26 09:36:43.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216220,ACTIVE,VIDEO,2020-07-30 12:14:03.094 +0000
687205395400,2680065434868,2020-03-26 09:36:43.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-30 12:14:03.095 +0000
687205395387,2680065434863,2020-03-26 09:35:49.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216220,ACTIVE,VIDEO,2020-07-30 12:14:03.093 +0000
687205395402,2680065434881,2020-03-26 09:37:17.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216220,ACTIVE,VIDEO,2020-07-30 12:14:03.096 +0000
687205395389,2680065434863,2020-03-26 09:35:49.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216199,ACTIVE,VIDEO,2020-07-30 12:14:03.094 +0000
687205395433,2680065434898,2020-03-26 09:38:46.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216220,ACTIVE,VIDEO,2020-07-30 12:14:03.097 +0000
687205395404,2680065434881,2020-03-26 09:37:17.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216199,ACTIVE,VIDEO,2020-07-30 12:14:03.097 +0000
687205395401,2680065434868,2020-03-26 09:36:43.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216199,ACTIVE,VIDEO,2020-07-30 12:14:03.095 +0000
687205395435,2680065434898,2020-03-26 09:38:46.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216199,ACTIVE,VIDEO,2020-07-30 12:14:03.098 +0000
687205395434,2680065434898,2020-03-26 09:38:46.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-06-23 18:14:30.000 +0000
id,ad_group_id,created_time,destination_url,name,pin_id,status,creative_type,_fivetran_synced,ad_account_id
687205395434,2680065434898,2020-03-26 09:38:46.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-30 12:14:03.098 +0000,549760489669
687205395435,2680065434898,2020-03-26 09:38:46.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216199,ACTIVE,VIDEO,2020-07-30 12:14:03.098 +0000,549760489669
687205395433,2680065434898,2020-03-26 09:38:46.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216220,ACTIVE,VIDEO,2020-07-30 12:14:03.097 +0000,549760489669
687205395404,2680065434881,2020-03-26 09:37:17.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216199,ACTIVE,VIDEO,2020-07-30 12:14:03.097 +0000,549760489669
687205395403,2680065434881,2020-03-26 09:37:17.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-30 12:14:03.096 +0000,549760489669
687205395402,2680065434881,2020-03-26 09:37:17.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216220,ACTIVE,VIDEO,2020-07-30 12:14:03.096 +0000,549760489669
687205395400,2680065434868,2020-03-26 09:36:43.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-30 12:14:03.095 +0000,549760489669
687205395401,2680065434868,2020-03-26 09:36:43.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216199,ACTIVE,VIDEO,2020-07-30 12:14:03.095 +0000,549760489669
687205395399,2680065434868,2020-03-26 09:36:43.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216220,ACTIVE,VIDEO,2020-07-30 12:14:03.094 +0000,549760489669
687205395389,2680065434863,2020-03-26 09:35:49.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216199,ACTIVE,VIDEO,2020-07-30 12:14:03.094 +0000,549760489669
687205395388,2680065434863,2020-03-26 09:35:49.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-30 12:14:03.093 +0000,549760489669
687205395387,2680065434863,2020-03-26 09:35:49.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216220,ACTIVE,VIDEO,2020-07-30 12:14:03.093 +0000,549760489669
687205395434,2680065434898,2020-03-26 09:38:46.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-24 00:14:18.647 +0000,549760489669
687205395388,2680065434863,2020-03-26 09:35:49.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-23 12:14:01.610 +0000,549760489669
687205395403,2680065434881,2020-03-26 09:37:17.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-07-01 12:14:37.616 +0000,549760489669
687205395434,2680065434898,2020-03-26 09:38:46.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-06-23 18:14:30.000 +0000,549760489669
687205395399,2680065434868,2020-03-26 09:36:43.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216220,ACTIVE,VIDEO,2020-06-15 18:14:18.130 +0000,549760489669
687205395400,2680065434868,2020-03-26 09:36:43.000 +0000,https://website.com/page?utm_source=sdfds,8d2b9c960e7bf8a6c22239377c1e6d81,848506386032216135,ACTIVE,VIDEO,2020-05-28 06:14:04.150 +0000,549760489669
4 changes: 0 additions & 4 deletions models/pinterest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,10 @@ models:
description: "{{ doc('advertiser_id') }}"
tests:
- not_null
- name: advertiser_status
description: Status of the advertiser account.
- name: currency_code
description: The currency code which the advertiser is set up using.
- name: country
description: The country code where the advertiser is located.
- name: billing_type
description: The billing type of the advertiser. Will typically be CREDIT_CARD or INVOICE.
- name: spend
description: "{{ doc('spend') }}"
- name: clicks
Expand Down
4 changes: 1 addition & 3 deletions models/pinterest_ads__advertiser_report.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ fields as (
report.date_day,
advertisers.advertiser_name,
report.advertiser_id,
advertisers.advertiser_status,
advertisers.currency_code,
advertisers.country,
advertisers.billing_type,
sum(report.spend) as spend,
sum(report.clicks) as clicks,
sum(report.impressions) as impressions
Expand All @@ -32,7 +30,7 @@ fields as (
from report
left join advertisers
on report.advertiser_id = advertisers.advertiser_id
{{ dbt_utils.group_by(7) }}
{{ dbt_utils.group_by(5) }}
)

select *
Expand Down
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/pinterest_source
version: [">=0.7.0", "<0.8.0"]
version: [">=0.9.0", "<0.10.0"]