Skip to content

Commit 7c0b3c3

Browse files
Merge pull request #12 from casparwylie/#11-use-date-types-for-date-fields
Use DATE types for all date fields
2 parents 51d04ee + 788dfe2 commit 7c0b3c3

26 files changed

+125
-115
lines changed

.buildkite/hooks/pre-command

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ export CI_SNOWFLAKE_DBT_USER=$(gcloud secrets versions access latest --secret="C
2121
export CI_SNOWFLAKE_DBT_WAREHOUSE=$(gcloud secrets versions access latest --secret="CI_SNOWFLAKE_DBT_WAREHOUSE" --project="dbt-package-testing-363917")
2222
export CI_DATABRICKS_DBT_HOST=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HOST" --project="dbt-package-testing-363917")
2323
export CI_DATABRICKS_DBT_HTTP_PATH=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_HTTP_PATH" --project="dbt-package-testing-363917")
24-
export CI_DATABRICKS_DBT_TOKEN=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_TOKEN" --project="dbt-package-testing-363917")
24+
export CI_DATABRICKS_DBT_TOKEN=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_TOKEN" --project="dbt-package-testing-363917")
25+
export CI_DATABRICKS_DBT_CATALOG=$(gcloud secrets versions access latest --secret="CI_DATABRICKS_DBT_CATALOG" --project="dbt-package-testing-363917")

.buildkite/pipeline.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ steps:
5858
commands: |
5959
bash .buildkite/scripts/run_models.sh redshift
6060
61-
- label: ":bricks: Run Tests - Databricks"
61+
- label: ":databricks: Run Tests - Databricks"
6262
key: "run_dbt_databricks"
6363
plugins:
6464
- docker#v3.13.0:
@@ -69,5 +69,6 @@ steps:
6969
- "CI_DATABRICKS_DBT_HOST"
7070
- "CI_DATABRICKS_DBT_HTTP_PATH"
7171
- "CI_DATABRICKS_DBT_TOKEN"
72+
- "CI_DATABRICKS_DBT_CATALOG"
7273
commands: |
7374
bash .buildkite/scripts/run_models.sh databricks

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# dbt_google_play_source v0.3.1
2+
[PR #12](https://github.com/fivetran/dbt_google_play_source/pull/12) includes the following updates:
3+
## 🪲 Bug fixes:
4+
- Updated staging models to cast `date_day` columns to the `date` datatype. This prevents downstream datatype conflicts when joining on these columns.
5+
6+
## Contributors
7+
- [@casparwylie](https://github.com/casparwylie) ([#12](https://github.com/fivetran/dbt_google_play_source/pull/12))
8+
19
# dbt_google_play_source v0.3.0
210
## 🚨 Breaking Changes 🚨:
311
[PR #11](https://github.com/fivetran/dbt_google_play_source/pull/11) includes the following changes:

dbt_project.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'google_play_source'
2-
version: '0.3.0'
2+
version: '0.3.1'
33
config-version: 2
44
require-dbt-version: [">=1.3.0", "<2.0.0"]
55
vars:

docs/catalog.json

+1-1
Large diffs are not rendered by default.

docs/index.html

+12-12
Large diffs are not rendered by default.

docs/manifest.json

+1-1
Large diffs are not rendered by default.

docs/run_results.json

+1-1
Large diffs are not rendered by default.

integration_tests/ci/sample.profiles.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ integration_tests:
4545
schema: google_play_source_integration_tests_1
4646
threads: 8
4747
databricks:
48-
catalog: null
48+
catalog: "{{ env_var('CI_DATABRICKS_DBT_CATALOG') }}"
4949
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
5050
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
5151
schema: google_play_source_integration_tests_1
52-
threads: 2
52+
threads: 8
5353
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
5454
type: databricks

integration_tests/dbt_project.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'google_play_source_integration_tests'
2-
version: '0.3.0'
2+
version: '0.3.1'
33
profile: 'integration_tests'
44
config-version: 2
55

models/stg_google_play__stats_crashes_app_version.sql

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
with base as (
33

4-
select *
4+
select *
55
from {{ ref('stg_google_play__stats_crashes_app_version_tmp') }}
66
),
77

@@ -19,9 +19,9 @@ fields as (
1919
),
2020

2121
final as (
22-
23-
select
24-
date as date_day,
22+
23+
select
24+
cast(date as date) as date_day,
2525
app_version_code,
2626
package_name,
2727
sum(daily_anrs) as anrs,
@@ -30,5 +30,5 @@ final as (
3030
group by 1,2,3
3131
)
3232

33-
select *
33+
select *
3434
from final
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
with base as (
33

4-
select *
4+
select *
55
from {{ ref('stg_google_play__stats_crashes_os_version_tmp') }}
66
),
77

@@ -14,14 +14,14 @@ fields as (
1414
staging_columns=get_stats_crashes_os_version_columns()
1515
)
1616
}}
17-
17+
1818
from base
1919
),
2020

2121
final as (
22-
23-
select
24-
date as date_day,
22+
23+
select
24+
cast(date as date) as date_day,
2525
android_os_version,
2626
package_name,
2727
sum(daily_anrs) as anrs,
@@ -30,5 +30,5 @@ final as (
3030
group by 1,2,3
3131
)
3232

33-
select *
33+
select *
3434
from final
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
with base as (
33

4-
select *
4+
select *
55
from {{ ref('stg_google_play__stats_crashes_overview_tmp') }}
66
),
77

@@ -14,20 +14,20 @@ fields as (
1414
staging_columns=get_stats_crashes_overview_columns()
1515
)
1616
}}
17-
17+
1818
from base
1919
),
2020

2121
final as (
22-
22+
2323
select
24-
date as date_day,
24+
cast(date as date) as date_day,
2525
package_name,
2626
daily_anrs as anrs,
2727
daily_crashes as crashes,
2828
_fivetran_synced
2929
from fields
3030
)
3131

32-
select *
32+
select *
3333
from final

models/stg_google_play__stats_installs_app_version.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
with base as (
33

4-
select *
4+
select *
55
from {{ ref('stg_google_play__stats_installs_app_version_tmp') }}
66
),
77

@@ -14,14 +14,14 @@ fields as (
1414
staging_columns=get_stats_installs_app_version_columns()
1515
)
1616
}}
17-
17+
1818
from base
1919
),
2020

2121
final as (
22-
23-
select
24-
date as date_day,
22+
23+
select
24+
cast(date as date) as date_day,
2525
app_version_code,
2626
package_name,
2727
sum(active_device_installs) as active_devices_last_30_days,
@@ -37,5 +37,5 @@ final as (
3737
group by 1,2,3
3838
)
3939

40-
select *
40+
select *
4141
from final

models/stg_google_play__stats_installs_country.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
with base as (
33

4-
select *
4+
select *
55
from {{ ref('stg_google_play__stats_installs_country_tmp') }}
66
),
77

@@ -14,14 +14,14 @@ fields as (
1414
staging_columns=get_stats_installs_country_columns()
1515
)
1616
}}
17-
17+
1818
from base
1919
),
2020

2121
final as (
22-
23-
select
24-
date as date_day,
22+
23+
select
24+
cast(date as date) as date_day,
2525
country,
2626
package_name,
2727
sum(active_device_installs) as active_devices_last_30_days,
@@ -37,5 +37,5 @@ final as (
3737
group by 1,2,3
3838
)
3939

40-
select *
40+
select *
4141
from final

models/stg_google_play__stats_installs_device.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
with base as (
33

4-
select *
4+
select *
55
from {{ ref('stg_google_play__stats_installs_device_tmp') }}
66
),
77

@@ -14,14 +14,14 @@ fields as (
1414
staging_columns=get_stats_installs_device_columns()
1515
)
1616
}}
17-
17+
1818
from base
1919
),
2020

2121
final as (
22-
23-
select
24-
date as date_day,
22+
23+
select
24+
cast(date as date) as date_day,
2525
device, -- device_type
2626
package_name,
2727
sum(active_device_installs) as active_devices_last_30_days,
@@ -38,5 +38,5 @@ final as (
3838

3939
)
4040

41-
select *
41+
select *
4242
from final

models/stg_google_play__stats_installs_os_version.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
with base as (
33

4-
select *
4+
select *
55
from {{ ref('stg_google_play__stats_installs_os_version_tmp') }}
66
),
77

@@ -14,14 +14,14 @@ fields as (
1414
staging_columns=get_stats_installs_os_version_columns()
1515
)
1616
}}
17-
17+
1818
from base
1919
),
2020

2121
final as (
22-
23-
select
24-
date as date_day,
22+
23+
select
24+
cast(date as date) as date_day,
2525
package_name,
2626
android_os_version,
2727
sum(active_device_installs) as active_devices_last_30_days,
@@ -37,5 +37,5 @@ final as (
3737
group by 1,2,3
3838
)
3939

40-
select *
40+
select *
4141
from final

models/stg_google_play__stats_installs_overview.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
with base as (
33

4-
select *
4+
select *
55
from {{ ref('stg_google_play__stats_installs_overview_tmp') }}
66
),
77

@@ -14,14 +14,14 @@ fields as (
1414
staging_columns=get_stats_installs_overview_columns()
1515
)
1616
}}
17-
17+
1818
from base
1919
),
2020

2121
final as (
22-
23-
select
24-
date as date_day,
22+
23+
select
24+
cast(date as date) as date_day,
2525
package_name,
2626
active_device_installs as active_devices_last_30_days,
2727
daily_device_installs as device_installs,
@@ -36,5 +36,5 @@ final as (
3636
from fields
3737
)
3838

39-
select *
39+
select *
4040
from final
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
with base as (
33

4-
select *
4+
select *
55
from {{ ref('stg_google_play__stats_ratings_app_version_tmp') }}
66
),
77

@@ -14,14 +14,14 @@ fields as (
1414
staging_columns=get_stats_ratings_app_version_columns()
1515
)
1616
}}
17-
17+
1818
from base
1919
),
2020

2121
final as (
22-
23-
select
24-
date as date_day,
22+
23+
select
24+
cast(date as date) as date_day,
2525
app_version_code,
2626
package_name,
2727
case when app_version_code is null then null else cast( nullif(cast(daily_average_rating as {{ dbt.type_string() }}), 'NA') as {{ dbt.type_float() }} ) end as average_rating,
@@ -30,5 +30,5 @@ final as (
3030
{{ dbt_utils.group_by(n=5) }}
3131
)
3232

33-
select *
33+
select *
3434
from final

0 commit comments

Comments
 (0)