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

Bug/add alt country names #10

Merged
merged 7 commits into from
May 3, 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
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# dbt_apple_store_source v0.UPDATE.UPDATE
# dbt_apple_store_source v0.3.0

## Under the Hood:
## Bug Fixes
[PR #10](https://github.com/fivetran/dbt_apple_store_source/pull/10) includes the following changes:
- Updated the [country code](https://github.com/fivetran/dbt_apple_store_source/blob/main/seeds/apple_store_country_codes.csv) mapping table to align with Apple's [format and inclusion list](https://developer.apple.com/help/app-store-connect/reference/app-store-localizations/) of country names.
- This is a 🚨**breaking change**🚨 as you will need to re-seed (`dbt seed --full-refresh`) the `apple_store_country_codes` file again.

## Under the Hood
[PR #9](https://github.com/fivetran/dbt_apple_store_source/pull/9) includes the following changes:
- Incorporated the new `fivetran_utils.drop_schemas_automation` macro into the end of each Buildkite integration test job.
- Updated the pull request [templates](/.github).

# dbt_apple_store_source v0.2.1

## Bug Fixes
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Include the following apple_store_source package version in your `packages.yml`
```yaml
packages:
- package: fivetran/apple_store_source
version: [">=0.2.0", "<0.3.0"] # we recommend using ranges to capture non-breaking changes automatically
version: [">=0.3.0", "<0.4.0"] # we recommend using ranges to capture non-breaking changes automatically
```
## Step 3: Define database and schema variables
By default, this package runs using your destination and the `apple_store` schema. If this is not where your apple_store data is (for example, if your apple_store schema is named `apple_store_fivetran`), add the following configuration to your root `dbt_project.yml` file:
Expand All @@ -41,15 +41,21 @@ vars:
apple_store_database: your_destination_name
apple_store_schema: your_schema_name
```
## Step 3: Enabling additional models
## Step 4: Enabling additional models
Your Apple App Store connector may not sync every table that this package expects. If you use subscriptions and have the `sales_subscription_event_summary` and `sales_subscription_summary` tables synced, add the following variable to your `dbt_project.yml` file:

```yml
vars:
apple_store__using_subscriptions: true # by default this is assumed to be false
```

## (Optional) Step 4: Additional configurations
## Step 5: Seed `country_codes` mapping table (once)

In order to map longform territory names to their ISO country codes, we have adapted the CSV from [lukes/ISO-3166-Countries-with-Regional-Codes](https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes) to align with Apple's country output [format](https://developer.apple.com/help/app-store-connect/reference/app-store-localizations/).

You will need to `dbt seed` the `apple_store_country_codes` [file](https://github.com/fivetran/dbt_apple_store_source/blob/main/seeds/apple_store_country_codes.csv) just once.

## (Optional) Step 6: Additional configurations
<details><summary>Expand to view configurations</summary>

### Defining subscription events
Expand Down Expand Up @@ -84,7 +90,7 @@ vars:

</details>

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

Expand Down
7 changes: 6 additions & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'apple_store_source'
version: '0.2.1'
version: '0.3.0'
config-version: 2
require-dbt-version: [">=1.3.0", "<2.0.0"]
vars:
Expand Down Expand Up @@ -34,3 +34,8 @@ models:
seeds:
apple_store_source:
+schema: apple_store_source
+column_types:
country_name: "{{ 'string' if target.type in ['bigquery','spark','databricks'] else 'varchar(255)' }}"
alternative_country_name: "{{ 'string' if target.type in ['bigquery','spark','databricks'] else 'varchar(255)' }}"
region: "{{ 'string' if target.type in ['bigquery','spark','databricks'] else 'varchar(255)' }}"
sub_region: "{{ 'string' if target.type in ['bigquery','spark','databricks'] else 'varchar(255)' }}"
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.

2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config-version: 2

name: 'apple_store_source_integration_tests'
version: '0.2.1'
version: '0.3.0'

profile: 'integration_tests'

Expand Down
5 changes: 5 additions & 0 deletions integration_tests/seeds/app_store_territory_source_type.csv
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ app_id,date,source_type,territory,meets_threshold,impressions,_fivetran_synced,i
12345,2021-05-09 00:00:00+00:00,App Store Browse,Canada,True,0,2022-01-02 12:34:56.789000+00:00,0,0,0
12345,2021-05-18 00:00:00+00:00,App Store Search,Canada,True,3,2022-01-02 12:34:56.789000+00:00,2,1,1
12345,2021-10-21 00:00:00+00:00,App Store Search,Canada,True,0,2022-01-02 12:34:56.789000+00:00,0,0,0
12345,2021-10-23 00:00:00+00:00,App Store Search,Kosovo,True,0,2022-01-02 12:34:56.789000+00:00,0,0,0
12345,2021-11-24 00:00:00+00:00,App Store Search,Kosovo,True,0,2022-01-02 12:34:56.789000+00:00,0,0,3
12345,2021-10-24 00:00:00+00:00,App Store Search,Côte d'Ivoire,True,0,2022-01-02 12:34:56.789000+00:00,0,0,3
12345,2021-10-26 00:00:00+00:00,App Store Search,Cote d'Ivoire,True,0,2022-01-02 12:34:56.789000+00:00,0,0,3
12345,2021-11-26 00:00:00+00:00,App Store Search,Cote d'Ivoire,True,0,2022-01-02 12:34:56.789000+00:00,0,0,3
2 changes: 1 addition & 1 deletion models/stg_apple_store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ seeds:
description: '{{ doc("country_code_numeric") }}'
- name: country_code_alpha_2
description: '{{ doc("country_code_alpha_2") }}'
- name: country_code_alpha3
- name: country_code_alpha_3
description: '{{ doc("country_code_alpha_3") }}'
- name: region
description: '{{ doc("region") }}'
Expand Down
29 changes: 15 additions & 14 deletions seeds/apple_store_country_codes.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Brunei Darussalam,Brunei,96,BN,BRN,Asia,142,South-eastern Asia,035
Bulgaria,,100,BG,BGR,Europe,150,Eastern Europe,151
Burkina Faso,,854,BF,BFA,Africa,002,Sub-Saharan Africa,202
Burundi,,108,BI,BDI,Africa,002,Sub-Saharan Africa,202
Cabo Verde,,132,CV,CPV,Africa,002,Sub-Saharan Africa,202
Cabo Verde,Cape Verde,132,CV,CPV,Africa,002,Sub-Saharan Africa,202
Cambodia,,116,KH,KHM,Asia,142,South-eastern Asia,035
Cameroon,,120,CM,CMR,Africa,002,Sub-Saharan Africa,202
Canada,,124,CA,CAN,Americas,019,Northern America,021
Expand All @@ -49,11 +49,11 @@ Christmas Island,,162,CX,CXR,Oceania,009,Australia and New Zealand,053
Cocos (Keeling) Islands,,166,CC,CCK,Oceania,009,Australia and New Zealand,053
Colombia,,170,CO,COL,Americas,019,Latin America and the Caribbean,419
Comoros,,174,KM,COM,Africa,002,Sub-Saharan Africa,202
Congo,,178,CG,COG,Africa,002,Sub-Saharan Africa,202
Congo,"Congo, Republic of the",178,CG,COG,Africa,002,Sub-Saharan Africa,202
"Congo, Democratic Republic of the",,180,CD,COD,Africa,002,Sub-Saharan Africa,202
Cook Islands,,184,CK,COK,Oceania,009,Polynesia,061
Costa Rica,,188,CR,CRI,Americas,019,Latin America and the Caribbean,419
Côte d'Ivoire,,384,CI,CIV,Africa,002,Sub-Saharan Africa,202
Côte d'Ivoire,Cote d'Ivoire,384,CI,CIV,Africa,002,Sub-Saharan Africa,202
Croatia,,191,HR,HRV,Europe,150,Southern Europe,039
Cuba,,192,CU,CUB,Americas,019,Latin America and the Caribbean,419
Curaçao,,531,CW,CUW,Americas,019,Latin America and the Caribbean,419
Expand Down Expand Up @@ -143,7 +143,7 @@ Mauritania,,478,MR,MRT,Africa,002,Sub-Saharan Africa,202
Mauritius,,480,MU,MUS,Africa,002,Sub-Saharan Africa,202
Mayotte,,175,YT,MYT,Africa,002,Sub-Saharan Africa,202
Mexico,,484,MX,MEX,Americas,019,Latin America and the Caribbean,419
Micronesia (Federated States of),,583,FM,FSM,Oceania,009,Micronesia,057
Micronesia (Federated States of),Micronesia,583,FM,FSM,Oceania,009,Micronesia,057
"Moldova, Republic of",Moldova,498,MD,MDA,Europe,150,Eastern Europe,151
Monaco,,492,MC,MCO,Europe,150,Western Europe,155
Mongolia,,496,MN,MNG,Asia,142,Eastern Asia,030
Expand Down Expand Up @@ -184,16 +184,16 @@ Réunion,,638,RE,REU,Africa,002,Sub-Saharan Africa,202
Romania,,642,RO,ROU,Europe,150,Eastern Europe,151
Russian Federation,Russia,643,RU,RUS,Europe,150,Eastern Europe,151
Rwanda,,646,RW,RWA,Africa,002,Sub-Saharan Africa,202
Saint Barthélemy,,652,BL,BLM,Americas,019,Latin America and the Caribbean,419
"Saint Helena, Ascension and Tristan da Cunha",,654,SH,SHN,Africa,002,Sub-Saharan Africa,202
Saint Kitts and Nevis,,659,KN,KNA,Americas,019,Latin America and the Caribbean,419
Saint Lucia,,662,LC,LCA,Americas,019,Latin America and the Caribbean,419
Saint Martin (French part),,663,MF,MAF,Americas,019,Latin America and the Caribbean,419
Saint Pierre and Miquelon,,666,PM,SPM,Americas,019,Northern America,021
Saint Vincent and the Grenadines,,670,VC,VCT,Americas,019,Latin America and the Caribbean,419
Saint Barthélemy,St. Barthélemy,652,BL,BLM,Americas,019,Latin America and the Caribbean,419
"Saint Helena, Ascension and Tristan da Cunha","St. Helena, Ascension and Tristan da Cunha",654,SH,SHN,Africa,002,Sub-Saharan Africa,202
Saint Kitts and Nevis,St. Kitts and Nevis,659,KN,KNA,Americas,019,Latin America and the Caribbean,419
Saint Lucia,St. Lucia,662,LC,LCA,Americas,019,Latin America and the Caribbean,419
Saint Martin (French part),St. Martin (French part),663,MF,MAF,Americas,019,Latin America and the Caribbean,419
Saint Pierre and Miquelon,St. Pierre and Miquelon,666,PM,SPM,Americas,019,Northern America,021
Saint Vincent and the Grenadines,St. Vincent and the Grenadines,670,VC,VCT,Americas,019,Latin America and the Caribbean,419
Samoa,,882,WS,WSM,Oceania,009,Polynesia,061
San Marino,,674,SM,SMR,Europe,150,Southern Europe,039
Sao Tome and Principe,,678,ST,STP,Africa,002,Sub-Saharan Africa,202
Sao Tome and Principe,São Tomé and Principe,678,ST,STP,Africa,002,Sub-Saharan Africa,202
Saudi Arabia,,682,SA,SAU,Asia,142,Western Asia,145
Senegal,,686,SN,SEN,Africa,002,Sub-Saharan Africa,202
Serbia,,688,RS,SRB,Europe,150,Southern Europe,039
Expand Down Expand Up @@ -226,7 +226,7 @@ Tokelau,,772,TK,TKL,Oceania,009,Polynesia,061
Tonga,,776,TO,TON,Oceania,009,Polynesia,061
Trinidad and Tobago,,780,TT,TTO,Americas,019,Latin America and the Caribbean,419
Tunisia,,788,TN,TUN,Africa,002,Northern Africa,015
Turkey,,792,TR,TUR,Asia,142,Western Asia,145
Turkey,Türkiye,792,TR,TUR,Asia,142,Western Asia,145
Turkmenistan,,795,TM,TKM,Asia,142,Central Asia,143
Turks and Caicos Islands,,796,TC,TCA,Americas,019,Latin America and the Caribbean,419
Tuvalu,,798,TV,TUV,Oceania,009,Polynesia,061
Expand All @@ -241,10 +241,11 @@ Uzbekistan,,860,UZ,UZB,Asia,142,Central Asia,143
Vanuatu,,548,VU,VUT,Oceania,009,Melanesia,054
Venezuela (Bolivarian Republic of),Venezuela,862,VE,VEN,Americas,019,Latin America and the Caribbean,419
Viet Nam,Vietnam,704,VN,VNM,Asia,142,South-eastern Asia,035
Virgin Islands (British),,92,VG,VGB,Americas,019,Latin America and the Caribbean,419
Virgin Islands (British),British Virgin Islands,92,VG,VGB,Americas,019,Latin America and the Caribbean,419
Virgin Islands (U.S.),,850,VI,VIR,Americas,019,Latin America and the Caribbean,419
Wallis and Futuna,,876,WF,WLF,Oceania,009,Polynesia,061
Western Sahara,,732,EH,ESH,Africa,002,Northern Africa,015
Yemen,,887,YE,YEM,Asia,142,Western Asia,145
Zambia,,894,ZM,ZMB,Africa,002,Sub-Saharan Africa,202
Zimbabwe,,716,ZW,ZWE,Africa,002,Sub-Saharan Africa,202
Kosovo,,383,XK,XKX,Europe,150,Southern Europe,039