Skip to content

Commit

Permalink
Merge pull request #83 from fivetran/feature/reddit_Ads
Browse files Browse the repository at this point in the history
add reddit ads
  • Loading branch information
fivetran-reneeli authored Mar 20, 2023
2 parents 471846e + 7f52c95 commit c99a1f9
Show file tree
Hide file tree
Showing 27 changed files with 574 additions and 47 deletions.
3 changes: 2 additions & 1 deletion .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ export CI_SNOWFLAKE_DBT_USER=$(gcloud secrets versions access latest --secret="C
export CI_SNOWFLAKE_DBT_WAREHOUSE=$(gcloud secrets versions access latest --secret="CI_SNOWFLAKE_DBT_WAREHOUSE" --project="dbt-package-testing-363917")
export CI_DATABRICKS_DBT_HOST=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HOST" --project="dbt-package-testing-363917")
export CI_DATABRICKS_DBT_HTTP_PATH=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HTTP_PATH" --project="dbt-package-testing-363917")
export CI_DATABRICKS_DBT_TOKEN=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_TOKEN" --project="dbt-package-testing-363917")
export CI_DATABRICKS_DBT_TOKEN=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_TOKEN" --project="dbt-package-testing-363917")
export CI_DATABRICKS_DBT_CATALOG=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_CATALOG" --project="dbt-package-testing-363917")
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ steps:
- "CI_DATABRICKS_DBT_HOST"
- "CI_DATABRICKS_DBT_HTTP_PATH"
- "CI_DATABRICKS_DBT_TOKEN"
- "CI_DATABRICKS_DBT_CATALOG"
commands: |
bash .buildkite/scripts/run_models.sh databricks
4 changes: 2 additions & 2 deletions .buildkite/scripts/run_models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ echo `pwd`
cd integration_tests
dbt deps
dbt seed --target "$db" --full-refresh
dbt run --target "$db" --full-refresh --vars '{ad_reporting__linkedin_ads_enabled: false, ad_reporting__pinterest_ads_enabled: false, ad_reporting__tiktok_ads_enabled: false, ad_reporting__snapchat_ads_enabled: false, ad_reporting__apple_search_ads_enabled: false, ad_reporting__facebook_ads_enabled: false}'
dbt test --target "$db" --vars '{ad_reporting__linkedin_ads_enabled: false, ad_reporting__pinterest_ads_enabled: false, ad_reporting__tiktok_ads_enabled: false, ad_reporting__snapchat_ads_enabled: false, ad_reporting__apple_search_ads_enabled: false, ad_reporting__facebook_ads_enabled: false}'
dbt run --target "$db" --full-refresh --vars '{ad_reporting__linkedin_ads_enabled: false, ad_reporting__pinterest_ads_enabled: false, ad_reporting__tiktok_ads_enabled: false, ad_reporting__snapchat_ads_enabled: false, ad_reporting__apple_search_ads_enabled: false, ad_reporting__facebook_ads_enabled: false, ad_reporting__amazon_ads_enabled: false}'
dbt test --target "$db" --vars '{ad_reporting__linkedin_ads_enabled: false, ad_reporting__pinterest_ads_enabled: false, ad_reporting__tiktok_ads_enabled: false, ad_reporting__snapchat_ads_enabled: false, ad_reporting__apple_search_ads_enabled: false, ad_reporting__facebook_ads_enabled: false, ad_reporting__amazon_ads_enabled: false}'
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# dbt_ad_reporting v1.3.0

## 🎉 Introducing Reddit Ads Compatibility 🎉
- We have added Reddit Ads as another platform in our Ad Reporting package ecosystem. ([PR #83](https://github.com/fivetran/dbt_ad_reporting/pull/83))

# dbt_ad_reporting v1.2.1

## Updates
Expand Down
57 changes: 37 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- [Snapchat Ads](https://github.com/fivetran/dbt_snapchat_ads)
- [TikTok Ads](https://github.com/fivetran/dbt_tiktok_ads)
- [Twitter Ads](https://github.com/fivetran/dbt_twitter)
- [Reddit Ads](https://github.com/fivetran/dbt_reddit_ads)
> NOTE: You do _not_ need to have all of these connector types to use this package, though you should have at least two.
- Generates a comprehensive data dictionary of your source and modeled Ad Reporting data via the [dbt docs site](https://fivetran.github.io/dbt_ad_reporting/)

Expand Down Expand Up @@ -54,6 +55,7 @@ Refer to the table below for a detailed view of final models materialized by def
- [Snapchat Ads](https://fivetran.com/docs/applications/snapchat-ads)
- [TikTok Ads](https://fivetran.com/docs/applications/tiktok-ads)
- [Twitter Ads](https://fivetran.com/docs/applications/twitter-ads)
- [Reddit Ads](https://fivetran.com/docs/applications/reddit-ads)
> While you need only one of the above connectors to utilize this package, we recommend having at least two to gain the rollup benefit of this package.
- **Database support**: This package has been tested on **BigQuery**, **Snowflake**, **Redshift**, **Postgres** and **Databricks**. Ensure you are using one of these supported databases.
Expand All @@ -75,7 +77,7 @@ Include the following github package version in your `packages.yml`
```yaml
packages:
- package: fivetran/ad_reporting
version: [">=1.2.0", "<1.3.0"]
version: [">=1.3.0", "<1.4.0"]
```
## Step 3: Configure Database and Schema Variables
By default, this package looks for your ad platform data in your target database. If this is not where your app platform data is stored, add the relevant `<connector>_database` variables to your `dbt_project.yml` file (see below).
Expand Down Expand Up @@ -110,7 +112,10 @@ vars:
snapchat_database: your_database_name
tiktok_ads_schema: tiktok_ads
tiktok_ads_database: your_database_name
tiktok_ads_database: your_database_name
reddit_ads_schema: reddit_ads
reddit_ads_database: your_database_name
```

## Step 4: Enabling/Disabling Models
Expand All @@ -131,6 +136,7 @@ vars:
ad_reporting__facebook_ads_enabled: False # by default this is assumed to be True
ad_reporting__snapchat_ads_enabled: False # by default this is assumed to be True
ad_reporting__tiktok_ads_enabled: False # by default this is assumed to be True
ad_reporting__reddit_ads_enabled: False # by default this is assumed to be True
```
### Enable/Disable Specific Reports within Platforms
For **Apple Search Ads**, if you are not utilizing the search functionality, you may choose to update the respective variable below.
Expand Down Expand Up @@ -202,6 +208,11 @@ models:
+schema: tiktok_ads
tiktok_ads_source:
+schema: tiktok_ads_source
reddit_ads:
+schema: reddit_ads
reddit_ads_source:
+schema: reddit_ads_source
```

> Provide a blank `+schema: ` to write to the `target_schema` without any suffix.
Expand Down Expand Up @@ -301,58 +312,64 @@ packages:
version: [">=0.1.0", "<0.2.0"]
- package: fivetran/apple_search_ads
version: [">=0.1.0", "<0.2.0"]
version: [">=0.2.0", "<0.3.0"]
- package: fivetran/apple_search_ads_source
version: [">=0.1.0", "<0.2.0"]
version: [">=0.2.0", "<0.3.0"]
- package: fivetran/facebook_ads
version: [">=0.5.0", "<0.6.0"]
version: [">=0.6.0", "<0.7.0"]
- package: fivetran/facebook_ads_source
version: [">=0.5.0", "<0.6.0"]
version: [">=0.6.0", "<0.7.0"]
- package: fivetran/google_ads
version: [">=0.8.0", "<0.9.0"]
version: [">=0.9.0", "<0.10.0"]
- package: fivetran/google_ads_source
version: [">=0.8.0", "<0.9.0"]
version: [">=0.9.0", "<0.10.0"]
- package: fivetran/pinterest
version: [">=0.6.0", "<0.7.0"]
version: [">=0.7.0", "<0.8.0"]
- package: fivetran/pinterest_source
version: [">=0.6.0", "<0.7.0"]
version: [">=0.7.0", "<0.8.0"]
- package: fivetran/microsoft_ads
version: [">=0.5.0", "<0.6.0"]
version: [">=0.6.0", "<0.7.0"]
- package: fivetran/microsoft_ads_source
version: [">=0.6.0", "<0.7.0"]
version: [">=0.7.0", "<0.8.0"]
- package: fivetran/linkedin
version: [">=0.5.0", "<0.6.0"]
version: [">=0.7.0", "<0.8.0"]
- package: fivetran/linkedin_source
version: [">=0.5.0", "<0.6.0"]
version: [">=0.7.0", "<0.8.0"]
- package: fivetran/twitter_ads
version: [">=0.5.0", "<0.6.0"]
version: [">=0.6.0", "<0.7.0"]
- package: fivetran/twitter_ads_source
version: [">=0.5.0", "<0.6.0"]
version: [">=0.6.0", "<0.7.0"]
- package: fivetran/snapchat_ads
version: [">=0.4.0", "<0.5.0"]
version: [">=0.5.0", "<0.6.0"]
- package: fivetran/snapchat_ads_source
version: [">=0.4.0", "<0.5.0"]
version: [">=0.5.0", "<0.6.0"]
- package: fivetran/tiktok_ads
version: [">=0.2.0", "<0.3.0"]
version: [">=0.3.0", "<0.4.0"]
- package: fivetran/tiktok_ads_source
version: [">=0.2.0", "<0.3.0"]
version: [">=0.3.0", "<0.4.0"]
- package: fivetran/reddit_ads
version: [">=0.1.0", "<0.2.0"]
- package: fivetran/reddit_ads_source
version: [">=0.1.0", "<0.2.0"]
```
# 🙌 How is this package maintained and can I contribute?
## Package Maintenance
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: 'ad_reporting'
version: '1.2.1'
version: '1.3.0'

config-version: 2

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/index.html

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.

12 changes: 6 additions & 6 deletions integration_tests/ci/sample.profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ integration_tests:
pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}"
dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}"
port: 5439
schema: ad_reporting_integration_tests_2
schema: ad_reporting_integration_tests_4
threads: 8
bigquery:
type: bigquery
method: service-account-json
project: 'dbt-package-testing'
schema: ad_reporting_integration_tests_2
schema: ad_reporting_integration_tests_4
threads: 8
keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}"
snowflake:
Expand All @@ -33,7 +33,7 @@ integration_tests:
role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}"
database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}"
warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}"
schema: ad_reporting_integration_tests_2
schema: ad_reporting_integration_tests_4
threads: 8
postgres:
type: postgres
Expand All @@ -42,13 +42,13 @@ integration_tests:
pass: "{{ env_var('CI_POSTGRES_DBT_PASS') }}"
dbname: "{{ env_var('CI_POSTGRES_DBT_DBNAME') }}"
port: 5432
schema: ad_reporting_integration_tests_2
schema: ad_reporting_integration_tests_4
threads: 8
databricks:
catalog: null
catalog: "{{ env_var('CI_DATABRICKS_DBT_CATALOG') }}"
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
schema: ad_reporting_integration_tests_2
schema: ad_reporting_integration_tests_4
threads: 2
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
type: databricks
73 changes: 61 additions & 12 deletions 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.2.1'
version: '1.3.0'
profile: 'integration_tests'
config-version: 2

Expand All @@ -16,7 +16,7 @@ vars:
twitter_ads__using_keywords: False

apple_search_ads_source:
apple_search_ads_schema: ad_reporting_integration_tests_2
apple_search_ads_schema: ad_reporting_integration_tests_4
apple_search_ads_organization_identifier: "apple_search_organization_data"
apple_search_ads_campaign_history_identifier: "apple_search_campaign_history_data"
apple_search_ads_campaign_report_identifier: "apple_search_campaign_report_data"
Expand All @@ -30,7 +30,7 @@ vars:
apple_search_ads__using_search_terms: True

google_ads_source:
google_ads_schema: ad_reporting_integration_tests_2
google_ads_schema: ad_reporting_integration_tests_4
google_ads_ad_stats_identifier: "google_ads_ad_stats_data"
google_ads_ad_history_identifier: "google_ads_ad_history_data"
google_ads_ad_group_history_identifier: "google_ads_ad_group_history_data"
Expand All @@ -43,7 +43,7 @@ vars:
google_ads_ad_group_criterion_history_identifier: "google_ads_ad_group_criterion_history_data"

microsoft_ads_source:
microsoft_ads_schema: ad_reporting_integration_tests_2
microsoft_ads_schema: ad_reporting_integration_tests_4
microsoft_ads_account_history_identifier: "microsoft_ads_account_history_data"
microsoft_ads_account_daily_report_identifier: "microsoft_ads_account_performance_daily_report_data"
microsoft_ads_ad_group_history_identifier: "microsoft_ads_ad_group_history_data"
Expand All @@ -57,7 +57,7 @@ vars:
microsoft_ads_search_daily_report_identifier: "microsoft_ads_search_performance_daily_report_data"

linkedin_source:
linkedin_ads_schema: ad_reporting_integration_tests_2
linkedin_ads_schema: ad_reporting_integration_tests_4
linkedin_ads_account_history_identifier: "linkedin_ad_account_history_data"
linkedin_ads_ad_analytics_by_creative_identifier: "linkedin_ad_analytics_by_creative_data"
linkedin_ads_campaign_group_history_identifier: "linkedin_ad_campaign_group_history_data"
Expand All @@ -66,7 +66,7 @@ vars:
linkedin_ads_ad_analytics_by_campaign_identifier: "linkedin_ad_analytics_by_campaign_data"

twitter_ads_source:
twitter_ads_schema: ad_reporting_integration_tests_2
twitter_ads_schema: ad_reporting_integration_tests_4
twitter_ads_account_history_identifier: "twitter_account_history_data"
twitter_ads_campaign_history_identifier: "twitter_campaign_history_data"
twitter_ads_line_item_history_identifier: "twitter_line_item_history_data"
Expand All @@ -80,7 +80,7 @@ vars:
twitter_ads_line_item_keywords_report_identifier: "twitter_line_item_keywords_report_data"

pinterest_source:
pinterest_schema: ad_reporting_integration_tests_2
pinterest_schema: ad_reporting_integration_tests_4
pinterest_ad_group_history_identifier: "pinterest_ads_ad_group_history_data"
pinterest_campaign_history_identifier: "pinterest_ads_campaign_history_data"
pinterest_pin_promotion_history_identifier: "pinterest_ads_pin_promotion_history_data"
Expand All @@ -93,7 +93,7 @@ vars:
pinterest_advertiser_report_identifier: "pinterest_ads_advertiser_report_data"

facebook_ads_source:
facebook_ads_schema: ad_reporting_integration_tests_2
facebook_ads_schema: ad_reporting_integration_tests_4
facebook_ads_account_history_identifier: "facebook_ads_account_history_data"
facebook_ads_ad_history_identifier: "facebook_ads_ad_history_data"
facebook_ads_ad_set_history_identifier: "facebook_ads_ad_set_history_data"
Expand All @@ -102,7 +102,7 @@ vars:
facebook_ads_creative_history_identifier: "facebook_ads_creative_history_data"

snapchat_ads_source:
snapchat_ads_schema: ad_reporting_integration_tests_2
snapchat_ads_schema: ad_reporting_integration_tests_4
snapchat_ads_ad_account_history_identifier: "snapchat_ad_account_history_data"
snapchat_ads_ad_history_identifier: "snapchat_ad_history_data"
snapchat_ads_ad_hourly_report_identifier: "snapchat_ad_hourly_report_data"
Expand All @@ -114,7 +114,7 @@ vars:
snapchat_ads_creative_url_tag_history_identifier: "snapchat_creative_url_tag_history_data"

tiktok_ads_source:
tiktok_ads_schema: ad_reporting_integration_tests_2
tiktok_ads_schema: ad_reporting_integration_tests_4
tiktok_ads__ad_group_history_identifier: "tiktok_adgroup_history_data"
tiktok_ads__ad_history_identifier: "tiktok_ad_history_data"
tiktok_ads__advertiser_identifier: "tiktok_advertiser_data"
Expand All @@ -124,7 +124,7 @@ vars:
tiktok_ads__campaign_report_hourly_identifier: "tiktok_campaign_report_hourly_data"

amazon_ads_source:
amazon_ads_schema: ad_reporting_integration_tests_2
amazon_ads_schema: ad_reporting_integration_tests_4
amazon_ads_ad_group_history_identifier: "amazon_ads_ad_group_history_data"
amazon_ads_ad_group_level_report_identifier: "amazon_ads_ad_group_level_report_data"
amazon_ads_advertised_product_report_identifier: "amazon_ads_advertised_product_report_data"
Expand All @@ -137,6 +137,18 @@ vars:
amazon_ads_targeting_keyword_report_identifier: "amazon_ads_targeting_keyword_report_data"
amazon_ads_search_term_ad_keyword_report_identifier: "amazon_ads_search_term_ad_keyword_report_data"

reddit_ads_source:
reddit_ads_schema: ad_reporting_integration_tests_4
reddit_ads_account_identifier: "reddit_ads_account_data"
reddit_ads_account_report_identifier: "reddit_ads_account_report_data"
reddit_ads_ad_identifier: "reddit_ads_ad_data"
reddit_ads_ad_report_identifier: "reddit_ads_ad_report_data"
reddit_ads_ad_group_identifier: "reddit_ads_ad_group_data"
reddit_ads_ad_group_report_identifier: "reddit_ads_ad_group_report_data"
reddit_ads_campaign_identifier: "reddit_ads_campaign_data"
reddit_ads_campaign_report_identifier: "reddit_ads_campaign_report_data"


seeds:
ad_reporting_integration_tests:
+quote_columns: "{{ true if target.type in ('redshift','postgres') else false }}"
Expand Down Expand Up @@ -529,4 +541,41 @@ seeds:
_fivetran_synced: "timestamp"
campaign_budget_amount: "float"
click_through_rate: "float"
keyword_bid: "float"
keyword_bid: "float"


### Reddit Ads Seeds

reddit_ads_account_data:
+column_types:
id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
reddit_ads_account_report_data:
+column_types:
account_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
reddit_ads_ad_data:
+column_types:
id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
reddit_ads_ad_report_data:
+column_types:
ad_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
account_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
reddit_ads_ad_group_data:
+column_types:
id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
ad_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
reddit_ads_ad_group_report_data:
+column_types:
account_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
ad_group_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
reddit_ads_campaign_data:
+column_types:
id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
account_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
reddit_ads_campaign_report_data:
+column_types:
account_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
campaign_id: "{{ 'INT64' if target.type == 'bigquery' else 'bigint' }}"
2 changes: 2 additions & 0 deletions integration_tests/seeds/reddit_ads_account_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,_fivetran_synced,attribution_type,click_attribution_window,created_at,currency,status,time_zone_id,view_attribution_window
1234,2023-01-09 22:21:17,ALL_CONVERSION,MONTH,2022-01-04 22:22:31,USD,,GMT,DAY
Loading

0 comments on commit c99a1f9

Please sign in to comment.