This SQL query combines data from multiple sources related to Apple Store app usage and crashes. It joins information about apps, their usage statistics, and crash reports, aggregating data by date, app ID, source type, and app version. The query creates a comprehensive report that includes various metrics such as active devices, installations, sessions, and crashes for each app version.
IntegrationAggregationCleaningWITH __dbt__cte__int_apple_store__crashes_app_version AS (
WITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__crashes_app_version
), aggregated AS (
SELECT
date_day,
app_id,
app_version,
CAST(NULL AS TEXT) AS source_type,
SUM(crashes) AS crashes
FROM base
GROUP BY
1,
2,
3,
4
)
SELECT
*
FROM aggregated
), app AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app
), crashes_app_version_report AS (
SELECT
*
FROM __dbt__cte__int_apple_store__crashes_app_version
), usage_app_version_report AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_app_version
), reporting_grain_combined AS (
SELECT
date_day,
app_id,
source_type,
app_version
FROM usage_app_version_report
UNION ALL
SELECT
date_day,
app_id,
source_type,
app_version
FROM crashes_app_version_report
), reporting_grain AS (
SELECT DISTINCT
*
FROM reporting_grain_combined
), joined AS (
SELECT
reporting_grain.date_day,
reporting_grain.app_id,
app.app_name,
reporting_grain.source_type,
reporting_grain.app_version,
COALESCE(crashes_app_version_report.crashes, 0) AS crashes,
COALESCE(usage_app_version_report.active_devices, 0) AS active_devices,
COALESCE(usage_app_version_report.active_devices_last_30_days, 0) AS active_devices_last_30_days,
COALESCE(usage_app_version_report.deletions, 0) AS deletions,
COALESCE(usage_app_version_report.installations, 0) AS installations,
COALESCE(usage_app_version_report.sessions, 0) AS sessions
FROM reporting_grain
LEFT JOIN app
ON reporting_grain.app_id = app.app_id
LEFT JOIN crashes_app_version_report
ON reporting_grain.date_day = crashes_app_version_report.date_day
AND reporting_grain.app_id = crashes_app_version_report.app_id
AND reporting_grain.source_type = crashes_app_version_report.source_type
AND reporting_grain.app_version = crashes_app_version_report.app_version
LEFT JOIN usage_app_version_report
ON reporting_grain.date_day = usage_app_version_report.date_day
AND reporting_grain.app_id = usage_app_version_report.app_id
AND reporting_grain.source_type = usage_app_version_report.source_type
AND reporting_grain.app_version = usage_app_version_report.app_version
)
SELECT
*
FROM joined
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
app_name | text | Application Name. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
app_version | text | The app version of the app that the user is engaging with. |
crashes | bigint | The number of recorded crashes experienced (User Opt-In only); a value of 0 indicates there were 0 crash reports or no value from the source report that day. |
active_devices | integer | The count of active_device is the count of devices that ran the app at least one time and for at least two seconds on a given day (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices or no value from the source report that day. |
active_devices_last_30_days | integer | The count of active_devices_last_30_days is the count of devices that ran the app at least one time and for at least two seconds on the date_day of the report minus 30 days (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices last 30 days or no value from the source report that day. |
deletions | integer | A deletion occurs when a user removes your app from their device (User Opt-In only). Data from resetting or erasing a device’s content and settings is not included. A value of 0 indicates there were 0 deletions or no value from the source report that day. |
installations | integer | An installation event is when the user opens the App after they've downloaded it (User Opt-In only). If the App was downloaded but not opened or opened offline, this will not count; if the user opts out of sending data back to Apple, there will also be no data here. A value of 0 indicates there were 0 installations or no value from the source report that day. |
sessions | integer | Sessions is the count of the number of times the app has been used for at least two seconds (User Opt-In only). If the app is in the background and is later used again, that counts as another session. A value of 0 indicates there were 0 sessions or no value from the source report that day. |
This SQL query integrates data from multiple Apple Store-related tables, including app information, app store device data, downloads, usage, and crashes. It combines these sources to create a comprehensive report on app performance across different devices. The query uses CTEs to prepare and join the data, and then creates a final output that includes various metrics such as impressions, page views, downloads, active devices, and crashes for each app, date, device, and source type combination.
IntegrationAggregationCleaningWITH __dbt__cte__int_apple_store__crashes_device AS (
WITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__crashes_app_version
), aggregated AS (
SELECT
date_day,
app_id,
device,
CAST(NULL AS TEXT) AS source_type,
SUM(crashes) AS crashes
FROM base
GROUP BY
1,
2,
3,
4
)
SELECT
*
FROM aggregated
), app AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app
), app_store_device AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app_store_device
), downloads_device AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__downloads_device
), usage_device AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_device
), crashes_device AS (
SELECT
*
FROM __dbt__cte__int_apple_store__crashes_device
), reporting_grain_combined AS (
SELECT
date_day,
app_id,
source_type,
device
FROM app_store_device
UNION ALL
SELECT
date_day,
app_id,
source_type,
device
FROM crashes_device
), reporting_grain AS (
SELECT DISTINCT
*
FROM reporting_grain_combined
), joined AS (
SELECT
reporting_grain.date_day,
reporting_grain.app_id,
app.app_name,
reporting_grain.source_type,
reporting_grain.device,
COALESCE(app_store_device.impressions, 0) AS impressions,
COALESCE(app_store_device.impressions_unique_device, 0) AS impressions_unique_device,
COALESCE(app_store_device.page_views, 0) AS page_views,
COALESCE(app_store_device.page_views_unique_device, 0) AS page_views_unique_device,
COALESCE(crashes_device.crashes, 0) AS crashes,
COALESCE(downloads_device.first_time_downloads, 0) AS first_time_downloads,
COALESCE(downloads_device.redownloads, 0) AS redownloads,
COALESCE(downloads_device.total_downloads, 0) AS total_downloads,
COALESCE(usage_device.active_devices, 0) AS active_devices,
COALESCE(usage_device.active_devices_last_30_days, 0) AS active_devices_last_30_days,
COALESCE(usage_device.deletions, 0) AS deletions,
COALESCE(usage_device.installations, 0) AS installations,
COALESCE(usage_device.sessions, 0) AS sessions
FROM reporting_grain
LEFT JOIN app
ON reporting_grain.app_id = app.app_id
LEFT JOIN app_store_device
ON reporting_grain.date_day = app_store_device.date_day
AND reporting_grain.app_id = app_store_device.app_id
AND reporting_grain.source_type = app_store_device.source_type
AND reporting_grain.device = app_store_device.device
LEFT JOIN crashes_device
ON reporting_grain.date_day = crashes_device.date_day
AND reporting_grain.app_id = crashes_device.app_id
AND reporting_grain.source_type = crashes_device.source_type
AND reporting_grain.device = crashes_device.device
LEFT JOIN downloads_device
ON reporting_grain.date_day = downloads_device.date_day
AND reporting_grain.app_id = downloads_device.app_id
AND reporting_grain.source_type = downloads_device.source_type
AND reporting_grain.device = downloads_device.device
LEFT JOIN usage_device
ON reporting_grain.date_day = usage_device.date_day
AND reporting_grain.app_id = usage_device.app_id
AND reporting_grain.source_type = usage_device.source_type
AND reporting_grain.device = usage_device.device
)
SELECT
*
FROM joined
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
app_name | text | Application Name. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
device | text | Device type associated with the respective metric(s). |
crashes | bigint | The number of recorded crashes experienced (User Opt-In only); a value of 0 indicates there were 0 crash reports or no value from the source report that day. |
impressions | integer | The number of times your app was viewed in the App Store for more than one second. This includes search results, Featured, Explore, Top Charts and App Product Page views. (Source: [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
impressions_unique_device | integer | The number of unique devices that have viewed your app for more than one second on on the Today, Games, Apps, Featured, Explore, Top Charts, Search tabs of the App Store and App Product Page views. This metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
page_views | integer | The total number of times your App Store product page was clicked and viewed; when a user taps on a link from an app, website or App Clip card that brings them to your App Store product page, the immediate product page_view is attributed to the referring app, website, or App Clip. (Sources: [Apple](https://help.apple.com/app-store-connect/#/itcf19c873df), [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
page_views_unique_device | integer | The number of unique devices that have viewed your App Store product page; this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
first_time_downloads | integer | The number of first time downloads for your app; credit is attributed to the referring app, website, or App Clip of the first time download. |
redownloads | integer | The count of redownloads where a redownload occurs when a user who previously downloaded your app adds it to their device again (User Opt-In only); credit is attributed to the source recorded when a user tapped to download/launch your app for the first time. A value of 0 indicates there were 0 redownloads or no value from the source report that day. |
total_downloads | integer | Total Downloads is the sum of Redownloads and First Time Downloads. |
active_devices | integer | The count of active_device is the count of devices that ran the app at least one time and for at least two seconds on a given day (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices or no value from the source report that day. |
active_devices_last_30_days | integer | The count of active_devices_last_30_days is the count of devices that ran the app at least one time and for at least two seconds on the date_day of the report minus 30 days (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices last 30 days or no value from the source report that day. |
deletions | integer | A deletion occurs when a user removes your app from their device (User Opt-In only). Data from resetting or erasing a device’s content and settings is not included. A value of 0 indicates there were 0 deletions or no value from the source report that day. |
installations | integer | An installation event is when the user opens the App after they've downloaded it (User Opt-In only). If the App was downloaded but not opened or opened offline, this will not count; if the user opts out of sending data back to Apple, there will also be no data here. A value of 0 indicates there were 0 installations or no value from the source report that day. |
sessions | integer | Sessions is the count of the number of times the app has been used for at least two seconds (User Opt-In only). If the app is in the background and is later used again, that counts as another session. A value of 0 indicates there were 0 sessions or no value from the source report that day. |
active_free_trial_introductory_offer_subscriptions | numeric | None |
active_pay_a_you_go_introductory_offer_subscriptions | numeric | None |
active_pay_up_front_introductory_offer_subscriptions | numeric | None |
active_standard_price_subscriptions | numeric | None |
event_renew | numeric | None |
event_cancel | numeric | None |
event_subscribe | numeric | None |
This SQL query combines data from multiple Apple Store-related sources to create a comprehensive overview report. It integrates information about app store performance, crashes, downloads, and usage statistics for each app on a daily basis. The query joins these different data sources, performs some aggregations within CTEs, and then brings everything together in a final joined table. It also includes data cleaning by using COALESCE to handle potential NULL values in the metrics.
IntegrationAggregationCleaningWITH __dbt__cte__int_apple_store__app_store_overview AS (
WITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app_store_device
), aggregated AS (
SELECT
date_day,
app_id,
SUM(impressions) AS impressions,
SUM(page_views) AS page_views
FROM base
GROUP BY
1,
2
)
SELECT
*
FROM aggregated
), __dbt__cte__int_apple_store__crashes_overview AS (
WITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__crashes_app_version
), aggregated AS (
SELECT
date_day,
app_id,
SUM(crashes) AS crashes
FROM base
GROUP BY
1,
2
)
SELECT
*
FROM aggregated
), __dbt__cte__int_apple_store__downloads_overview AS (
WITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__downloads_device
), aggregated AS (
SELECT
date_day,
app_id,
SUM(first_time_downloads) AS first_time_downloads,
SUM(redownloads) AS redownloads,
SUM(total_downloads) AS total_downloads
FROM base
GROUP BY
1,
2
)
SELECT
*
FROM aggregated
), __dbt__cte__int_apple_store__usage_overview AS (
WITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_device
), aggregated AS (
SELECT
date_day,
app_id,
SUM(active_devices) AS active_devices,
SUM(deletions) AS deletions,
SUM(installations) AS installations,
SUM(sessions) AS sessions
FROM base
GROUP BY
1,
2
)
SELECT
*
FROM aggregated
), app AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app
), app_store AS (
SELECT
*
FROM __dbt__cte__int_apple_store__app_store_overview
), crashes AS (
SELECT
*
FROM __dbt__cte__int_apple_store__crashes_overview
), downloads AS (
SELECT
*
FROM __dbt__cte__int_apple_store__downloads_overview
), usage AS (
SELECT
*
FROM __dbt__cte__int_apple_store__usage_overview
), reporting_grain AS (
SELECT DISTINCT
date_day,
app_id
FROM app_store
), joined AS (
SELECT
reporting_grain.date_day,
reporting_grain.app_id,
app.app_name,
COALESCE(app_store.impressions, 0) AS impressions,
COALESCE(app_store.page_views, 0) AS page_views,
COALESCE(crashes.crashes, 0) AS crashes,
COALESCE(downloads.first_time_downloads, 0) AS first_time_downloads,
COALESCE(downloads.redownloads, 0) AS redownloads,
COALESCE(downloads.total_downloads, 0) AS total_downloads,
COALESCE(usage.active_devices, 0) AS active_devices,
COALESCE(usage.deletions, 0) AS deletions,
COALESCE(usage.installations, 0) AS installations,
COALESCE(usage.sessions, 0) AS sessions
FROM reporting_grain
LEFT JOIN app
ON reporting_grain.app_id = app.app_id
LEFT JOIN app_store
ON reporting_grain.date_day = app_store.date_day
AND reporting_grain.app_id = app_store.app_id
LEFT JOIN crashes
ON reporting_grain.date_day = crashes.date_day
AND reporting_grain.app_id = crashes.app_id
LEFT JOIN downloads
ON reporting_grain.date_day = downloads.date_day
AND reporting_grain.app_id = downloads.app_id
LEFT JOIN usage
ON reporting_grain.date_day = usage.date_day
AND reporting_grain.app_id = usage.app_id
)
SELECT
*
FROM joined
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
app_name | text | Application Name. |
crashes | bigint | The number of recorded crashes experienced (User Opt-In only); a value of 0 indicates there were 0 crash reports or no value from the source report that day. |
impressions | bigint | The number of times your app was viewed in the App Store for more than one second. This includes search results, Featured, Explore, Top Charts and App Product Page views. (Source: [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
page_views | bigint | The total number of times your App Store product page was clicked and viewed; when a user taps on a link from an app, website or App Clip card that brings them to your App Store product page, the immediate product page_view is attributed to the referring app, website, or App Clip. (Sources: [Apple](https://help.apple.com/app-store-connect/#/itcf19c873df), [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
first_time_downloads | bigint | The number of first time downloads for your app; credit is attributed to the referring app, website, or App Clip of the first time download. |
redownloads | bigint | The count of redownloads where a redownload occurs when a user who previously downloaded your app adds it to their device again (User Opt-In only); credit is attributed to the source recorded when a user tapped to download/launch your app for the first time. A value of 0 indicates there were 0 redownloads or no value from the source report that day. |
total_downloads | bigint | Total Downloads is the sum of Redownloads and First Time Downloads. |
active_devices | bigint | The count of active_device is the count of devices that ran the app at least one time and for at least two seconds on a given day (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices or no value from the source report that day. |
deletions | bigint | A deletion occurs when a user removes your app from their device (User Opt-In only). Data from resetting or erasing a device’s content and settings is not included. A value of 0 indicates there were 0 deletions or no value from the source report that day. |
installations | bigint | An installation event is when the user opens the App after they've downloaded it (User Opt-In only). If the App was downloaded but not opened or opened offline, this will not count; if the user opts out of sending data back to Apple, there will also be no data here. A value of 0 indicates there were 0 installations or no value from the source report that day. |
sessions | bigint | Sessions is the count of the number of times the app has been used for at least two seconds (User Opt-In only). If the app is in the background and is later used again, that counts as another session. A value of 0 indicates there were 0 sessions or no value from the source report that day. |
active_free_trial_introductory_offer_subscriptions | numeric | None |
active_pay_as_you_go_introductory_offer_subscriptions | numeric | None |
active_pay_up_front_introductory_offer_subscriptions | numeric | None |
active_standard_price_subscriptions | numeric | None |
event_renew | numeric | None |
event_cancel | numeric | None |
event_subscribe | numeric | None |
This SQL query integrates data from multiple Apple Store-related tables, including app information, platform versions, crashes, downloads, and usage statistics. It combines these sources to create a comprehensive report that provides various metrics for each app, date, platform version, and source type. The query uses CTEs to organize and join the data, and includes aggregations for some metrics like crashes. The final result is a detailed view of app performance across different dimensions.
IntegrationAggregationCleaningWITH __dbt__cte__int_apple_store__platform_version AS (
WITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__crashes_platform_version
), aggregated AS (
SELECT
date_day,
app_id,
platform_version,
CAST(NULL AS TEXT) AS source_type,
SUM(crashes) AS crashes
FROM base
GROUP BY
1,
2,
3,
4
)
SELECT
*
FROM aggregated
), app AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app
), app_store_platform_version AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app_store_platform_version
), crashes_platform_version AS (
SELECT
*
FROM __dbt__cte__int_apple_store__platform_version
), downloads_platform_version AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__downloads_platform_version
), usage_platform_version AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_platform_version
), reporting_grain_combined AS (
SELECT
date_day,
app_id,
source_type,
platform_version
FROM app_store_platform_version
UNION ALL
SELECT
date_day,
app_id,
source_type,
platform_version
FROM crashes_platform_version
), reporting_grain AS (
SELECT DISTINCT
*
FROM reporting_grain_combined
), joined AS (
SELECT
reporting_grain.date_day,
reporting_grain.app_id,
app.app_name,
reporting_grain.source_type,
reporting_grain.platform_version,
COALESCE(app_store_platform_version.impressions, 0) AS impressions,
COALESCE(app_store_platform_version.impressions_unique_device, 0) AS impressions_unique_device,
COALESCE(app_store_platform_version.page_views, 0) AS page_views,
COALESCE(app_store_platform_version.page_views_unique_device, 0) AS page_views_unique_device,
COALESCE(crashes_platform_version.crashes, 0) AS crashes,
COALESCE(downloads_platform_version.first_time_downloads, 0) AS first_time_downloads,
COALESCE(downloads_platform_version.redownloads, 0) AS redownloads,
COALESCE(downloads_platform_version.total_downloads, 0) AS total_downloads,
COALESCE(usage_platform_version.active_devices, 0) AS active_devices,
COALESCE(usage_platform_version.active_devices_last_30_days, 0) AS active_devices_last_30_days,
COALESCE(usage_platform_version.deletions, 0) AS deletions,
COALESCE(usage_platform_version.installations, 0) AS installations,
COALESCE(usage_platform_version.sessions, 0) AS sessions
FROM reporting_grain
LEFT JOIN app
ON reporting_grain.app_id = app.app_id
LEFT JOIN app_store_platform_version
ON reporting_grain.date_day = app_store_platform_version.date_day
AND reporting_grain.app_id = app_store_platform_version.app_id
AND reporting_grain.source_type = app_store_platform_version.source_type
AND reporting_grain.platform_version = app_store_platform_version.platform_version
LEFT JOIN crashes_platform_version
ON reporting_grain.date_day = crashes_platform_version.date_day
AND reporting_grain.app_id = crashes_platform_version.app_id
AND reporting_grain.source_type = crashes_platform_version.source_type
AND reporting_grain.platform_version = crashes_platform_version.platform_version
LEFT JOIN downloads_platform_version
ON reporting_grain.date_day = downloads_platform_version.date_day
AND reporting_grain.app_id = downloads_platform_version.app_id
AND reporting_grain.source_type = downloads_platform_version.source_type
AND reporting_grain.platform_version = downloads_platform_version.platform_version
LEFT JOIN usage_platform_version
ON reporting_grain.date_day = usage_platform_version.date_day
AND reporting_grain.app_id = usage_platform_version.app_id
AND reporting_grain.source_type = usage_platform_version.source_type
AND reporting_grain.platform_version = usage_platform_version.platform_version
)
SELECT
*
FROM joined
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
app_name | text | Application Name. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
platform_version | text | The platform version of the device engaging with your app. |
crashes | bigint | The number of recorded crashes experienced (User Opt-In only); a value of 0 indicates there were 0 crash reports or no value from the source report that day. |
impressions | integer | The number of times your app was viewed in the App Store for more than one second. This includes search results, Featured, Explore, Top Charts and App Product Page views. (Source: [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
impressions_unique_device | integer | The number of unique devices that have viewed your app for more than one second on on the Today, Games, Apps, Featured, Explore, Top Charts, Search tabs of the App Store and App Product Page views. This metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
page_views | integer | The total number of times your App Store product page was clicked and viewed; when a user taps on a link from an app, website or App Clip card that brings them to your App Store product page, the immediate product page_view is attributed to the referring app, website, or App Clip. (Sources: [Apple](https://help.apple.com/app-store-connect/#/itcf19c873df), [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
page_views_unique_device | integer | The number of unique devices that have viewed your App Store product page; this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
first_time_downloads | integer | The number of first time downloads for your app; credit is attributed to the referring app, website, or App Clip of the first time download. |
redownloads | integer | The count of redownloads where a redownload occurs when a user who previously downloaded your app adds it to their device again (User Opt-In only); credit is attributed to the source recorded when a user tapped to download/launch your app for the first time. A value of 0 indicates there were 0 redownloads or no value from the source report that day. |
total_downloads | integer | Total Downloads is the sum of Redownloads and First Time Downloads. |
active_devices | integer | The count of active_device is the count of devices that ran the app at least one time and for at least two seconds on a given day (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices or no value from the source report that day. |
active_devices_last_30_days | integer | The count of active_devices_last_30_days is the count of devices that ran the app at least one time and for at least two seconds on the date_day of the report minus 30 days (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices last 30 days or no value from the source report that day. |
deletions | integer | A deletion occurs when a user removes your app from their device (User Opt-In only). Data from resetting or erasing a device’s content and settings is not included. A value of 0 indicates there were 0 deletions or no value from the source report that day. |
installations | integer | An installation event is when the user opens the App after they've downloaded it (User Opt-In only). If the App was downloaded but not opened or opened offline, this will not count; if the user opts out of sending data back to Apple, there will also be no data here. A value of 0 indicates there were 0 installations or no value from the source report that day. |
sessions | integer | Sessions is the count of the number of times the app has been used for at least two seconds (User Opt-In only). If the app is in the background and is later used again, that counts as another session. A value of 0 indicates there were 0 sessions or no value from the source report that day. |
This SQL query integrates data from multiple Apple Store-related tables (app store, downloads, and usage) based on date, app ID, and source type. It aggregates metrics such as impressions, page views, downloads, active devices, and sessions. The query joins these aggregated results with app information and combines them into a single comprehensive report, filling in missing values with zeros.
IntegrationAggregationCleaningWITH __dbt__cte__int_apple_store__app_store_source_type AS (
WITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app_store_device
), aggregated AS (
SELECT
date_day,
app_id,
source_type,
SUM(impressions) AS impressions,
SUM(page_views) AS page_views
FROM base
GROUP BY
1,
2,
3
)
SELECT
*
FROM aggregated
), __dbt__cte__int_apple_store__downloads_source_type AS (
WITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__downloads_device
), aggregated AS (
SELECT
date_day,
app_id,
source_type,
SUM(first_time_downloads) AS first_time_downloads,
SUM(redownloads) AS redownloads,
SUM(total_downloads) AS total_downloads
FROM base
GROUP BY
1,
2,
3
)
SELECT
*
FROM aggregated
), __dbt__cte__int_apple_store__usage_source_type AS (
WITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_device
), aggregated AS (
SELECT
date_day,
app_id,
source_type,
SUM(active_devices) AS active_devices,
SUM(deletions) AS deletions,
SUM(installations) AS installations,
SUM(sessions) AS sessions
FROM base
GROUP BY
1,
2,
3
)
SELECT
*
FROM aggregated
), app AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app
), app_store_source_type AS (
SELECT
*
FROM __dbt__cte__int_apple_store__app_store_source_type
), downloads_source_type AS (
SELECT
*
FROM __dbt__cte__int_apple_store__downloads_source_type
), usage_source_type AS (
SELECT
*
FROM __dbt__cte__int_apple_store__usage_source_type
), reporting_grain AS (
SELECT DISTINCT
date_day,
app_id,
source_type
FROM app_store_source_type
), joined AS (
SELECT
reporting_grain.date_day,
reporting_grain.app_id,
app.app_name,
reporting_grain.source_type,
COALESCE(app_store_source_type.impressions, 0) AS impressions,
COALESCE(app_store_source_type.page_views, 0) AS page_views,
COALESCE(downloads_source_type.first_time_downloads, 0) AS first_time_downloads,
COALESCE(downloads_source_type.redownloads, 0) AS redownloads,
COALESCE(downloads_source_type.total_downloads, 0) AS total_downloads,
COALESCE(usage_source_type.active_devices, 0) AS active_devices,
COALESCE(usage_source_type.deletions, 0) AS deletions,
COALESCE(usage_source_type.installations, 0) AS installations,
COALESCE(usage_source_type.sessions, 0) AS sessions
FROM reporting_grain
LEFT JOIN app
ON reporting_grain.app_id = app.app_id
LEFT JOIN app_store_source_type
ON reporting_grain.date_day = app_store_source_type.date_day
AND reporting_grain.app_id = app_store_source_type.app_id
AND reporting_grain.source_type = app_store_source_type.source_type
LEFT JOIN downloads_source_type
ON reporting_grain.date_day = downloads_source_type.date_day
AND reporting_grain.app_id = downloads_source_type.app_id
AND reporting_grain.source_type = downloads_source_type.source_type
LEFT JOIN usage_source_type
ON reporting_grain.date_day = usage_source_type.date_day
AND reporting_grain.app_id = usage_source_type.app_id
AND reporting_grain.source_type = usage_source_type.source_type
)
SELECT
*
FROM joined
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
app_name | text | Application Name. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
impressions | bigint | The number of times your app was viewed in the App Store for more than one second. This includes search results, Featured, Explore, Top Charts and App Product Page views. (Source: [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
page_views | bigint | The total number of times your App Store product page was clicked and viewed; when a user taps on a link from an app, website or App Clip card that brings them to your App Store product page, the immediate product page_view is attributed to the referring app, website, or App Clip. (Sources: [Apple](https://help.apple.com/app-store-connect/#/itcf19c873df), [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
first_time_downloads | bigint | The number of first time downloads for your app; credit is attributed to the referring app, website, or App Clip of the first time download. |
redownloads | bigint | The count of redownloads where a redownload occurs when a user who previously downloaded your app adds it to their device again (User Opt-In only); credit is attributed to the source recorded when a user tapped to download/launch your app for the first time. A value of 0 indicates there were 0 redownloads or no value from the source report that day. |
total_downloads | bigint | Total Downloads is the sum of Redownloads and First Time Downloads. |
active_devices | bigint | The count of active_device is the count of devices that ran the app at least one time and for at least two seconds on a given day (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices or no value from the source report that day. |
deletions | bigint | A deletion occurs when a user removes your app from their device (User Opt-In only). Data from resetting or erasing a device’s content and settings is not included. A value of 0 indicates there were 0 deletions or no value from the source report that day. |
installations | bigint | An installation event is when the user opens the App after they've downloaded it (User Opt-In only). If the App was downloaded but not opened or opened offline, this will not count; if the user opts out of sending data back to Apple, there will also be no data here. A value of 0 indicates there were 0 installations or no value from the source report that day. |
sessions | bigint | Sessions is the count of the number of times the app has been used for at least two seconds (User Opt-In only). If the app is in the background and is later used again, that counts as another session. A value of 0 indicates there were 0 sessions or no value from the source report that day. |
This SQL query integrates data from multiple tables related to an Apple Store application. It combines information about apps, territories, downloads, usage, and country codes to create a comprehensive report. The query joins these tables based on common fields like date, app ID, source type, and territory. It also performs some data cleaning by coalescing values and standardizing country codes. The result is a detailed view of app performance across different territories, including metrics such as impressions, downloads, active devices, and sessions.
IntegrationCleaningWITH app AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app
), app_store_territory AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app_store_territory
), country_codes AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.apple_store_country_codes
), downloads_territory AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__downloads_territory
), usage_territory AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_territory
), reporting_grain AS (
SELECT DISTINCT
date_day,
app_id,
source_type,
territory
FROM app_store_territory
), joined AS (
SELECT
reporting_grain.date_day,
reporting_grain.app_id,
app.app_name,
reporting_grain.source_type,
reporting_grain.territory AS territory_long,
COALESCE(
official_country_codes.country_code_alpha_2,
alternative_country_codes.country_code_alpha_2
) AS territory_short,
COALESCE(official_country_codes.region, alternative_country_codes.region) AS region,
COALESCE(official_country_codes.sub_region, alternative_country_codes.sub_region) AS sub_region,
COALESCE(app_store_territory.impressions, 0) AS impressions,
COALESCE(app_store_territory.impressions_unique_device, 0) AS impressions_unique_device,
COALESCE(app_store_territory.page_views, 0) AS page_views,
COALESCE(app_store_territory.page_views_unique_device, 0) AS page_views_unique_device,
COALESCE(downloads_territory.first_time_downloads, 0) AS first_time_downloads,
COALESCE(downloads_territory.redownloads, 0) AS redownloads,
COALESCE(downloads_territory.total_downloads, 0) AS total_downloads,
COALESCE(usage_territory.active_devices, 0) AS active_devices,
COALESCE(usage_territory.active_devices_last_30_days, 0) AS active_devices_last_30_days,
COALESCE(usage_territory.deletions, 0) AS deletions,
COALESCE(usage_territory.installations, 0) AS installations,
COALESCE(usage_territory.sessions, 0) AS sessions
FROM reporting_grain
LEFT JOIN app
ON reporting_grain.app_id = app.app_id
LEFT JOIN app_store_territory
ON reporting_grain.date_day = app_store_territory.date_day
AND reporting_grain.app_id = app_store_territory.app_id
AND reporting_grain.source_type = app_store_territory.source_type
AND reporting_grain.territory = app_store_territory.territory
LEFT JOIN downloads_territory
ON reporting_grain.date_day = downloads_territory.date_day
AND reporting_grain.app_id = downloads_territory.app_id
AND reporting_grain.source_type = downloads_territory.source_type
AND reporting_grain.territory = downloads_territory.territory
LEFT JOIN usage_territory
ON reporting_grain.date_day = usage_territory.date_day
AND reporting_grain.app_id = usage_territory.app_id
AND reporting_grain.source_type = usage_territory.source_type
AND reporting_grain.territory = usage_territory.territory
LEFT JOIN country_codes AS official_country_codes
ON reporting_grain.territory = official_country_codes.country_name
LEFT JOIN country_codes AS alternative_country_codes
ON reporting_grain.territory = alternative_country_codes.alternative_country_name
)
SELECT
*
FROM joined
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
app_name | text | Application Name. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
territory_long | text | Either the alternative country name, or the country name if the alternative doesn't exist. |
territory_short | text | The country associated with the subscription event metrics and subscription summary metric(s). This country code maps to ISO-3166 Alpha-2. |
region | character varying(255) | The UN Statistics region name assignment. ([Original Source](https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes/blob/master/all/all.csv)) |
sub_region | character varying(255) | The UN Statistics sub-region name. ([Original Source](https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes/blob/master/all/all.csv)) |
impressions | integer | The number of times your app was viewed in the App Store for more than one second. This includes search results, Featured, Explore, Top Charts and App Product Page views. (Source: [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
impressions_unique_device | integer | The number of unique devices that have viewed your app for more than one second on on the Today, Games, Apps, Featured, Explore, Top Charts, Search tabs of the App Store and App Product Page views. This metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
page_views | integer | The total number of times your App Store product page was clicked and viewed; when a user taps on a link from an app, website or App Clip card that brings them to your App Store product page, the immediate product page_view is attributed to the referring app, website, or App Clip. (Sources: [Apple](https://help.apple.com/app-store-connect/#/itcf19c873df), [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
page_views_unique_device | integer | The number of unique devices that have viewed your App Store product page; this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
first_time_downloads | integer | The number of first time downloads for your app; credit is attributed to the referring app, website, or App Clip of the first time download. |
redownloads | integer | The count of redownloads where a redownload occurs when a user who previously downloaded your app adds it to their device again (User Opt-In only); credit is attributed to the source recorded when a user tapped to download/launch your app for the first time. A value of 0 indicates there were 0 redownloads or no value from the source report that day. |
total_downloads | integer | Total Downloads is the sum of Redownloads and First Time Downloads. |
active_devices | integer | The count of active_device is the count of devices that ran the app at least one time and for at least two seconds on a given day (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices or no value from the source report that day. |
active_devices_last_30_days | integer | The count of active_devices_last_30_days is the count of devices that ran the app at least one time and for at least two seconds on the date_day of the report minus 30 days (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices last 30 days or no value from the source report that day. |
deletions | integer | A deletion occurs when a user removes your app from their device (User Opt-In only). Data from resetting or erasing a device’s content and settings is not included. A value of 0 indicates there were 0 deletions or no value from the source report that day. |
installations | integer | An installation event is when the user opens the App after they've downloaded it (User Opt-In only). If the App was downloaded but not opened or opened offline, this will not count; if the user opts out of sending data back to Apple, there will also be no data here. A value of 0 indicates there were 0 installations or no value from the source report that day. |
sessions | integer | Sessions is the count of the number of times the app has been used for at least two seconds (User Opt-In only). If the app is in the background and is later used again, that counts as another session. A value of 0 indicates there were 0 sessions or no value from the source report that day. |
This SQL query aggregates data from the 'stg_apple_store__app_store_device' table in the Apple Store database. It calculates the sum of impressions and page views for each unique combination of date and app ID. The query first selects all columns from the source table, then groups the data by date and app ID, summing the impressions and page views for each group.
AggregationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app_store_device
), aggregated AS (
SELECT
date_day,
app_id,
SUM(impressions) AS impressions,
SUM(page_views) AS page_views
FROM base
GROUP BY
1,
2
)
SELECT
*
FROM aggregated
Name | Type | Comment |
---|
This SQL query aggregates data from the 'stg_apple_store__app_store_device' table. It groups the data by date, app ID, and source type, and calculates the sum of impressions and page views for each group. The result is a summarized view of app performance metrics across different dimensions.
AggregationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app_store_device
), aggregated AS (
SELECT
date_day,
app_id,
source_type,
SUM(impressions) AS impressions,
SUM(page_views) AS page_views
FROM base
GROUP BY
1,
2,
3
)
SELECT
*
FROM aggregated
Name | Type | Comment |
---|
This SQL query aggregates crash data from the apple_store_source.stg_apple_store__crashes_app_version table. It groups the data by date, app ID, and app version, summing up the total crashes for each combination. The query also includes a NULL source_type column in the output.
AggregationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__crashes_app_version
), aggregated AS (
SELECT
date_day,
app_id,
app_version,
CAST(NULL AS TEXT) AS source_type,
SUM(crashes) AS crashes
FROM base
GROUP BY
1,
2,
3,
4
)
SELECT
*
FROM aggregated
Name | Type | Comment |
---|
This SQL query aggregates crash data from the Apple Store source table. It groups the data by date, app ID, and device, summing up the number of crashes. The query also includes a null column for source_type. The result is a simplified view of crash data across different dimensions.
AggregationCleaningWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__crashes_app_version
), aggregated AS (
SELECT
date_day,
app_id,
device,
CAST(NULL AS TEXT) AS source_type,
SUM(crashes) AS crashes
FROM base
GROUP BY
1,
2,
3,
4
)
SELECT
*
FROM aggregated
Name | Type | Comment |
---|
This query aggregates crash data from the 'stg_apple_store__crashes_app_version' table. It groups the data by date and app ID, summing the number of crashes for each combination. The result provides an overview of crashes for each app on each day.
AggregationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__crashes_app_version
), aggregated AS (
SELECT
date_day,
app_id,
SUM(crashes) AS crashes
FROM base
GROUP BY
1,
2
)
SELECT
*
FROM aggregated
Name | Type | Comment |
---|
This query aggregates download data for Apple Store apps. It sums up first-time downloads, redownloads, and total downloads for each app on each day. The query first selects all columns from a staging table, then groups the data by date and app ID, calculating the sum of various download types.
AggregationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__downloads_device
), aggregated AS (
SELECT
date_day,
app_id,
SUM(first_time_downloads) AS first_time_downloads,
SUM(redownloads) AS redownloads,
SUM(total_downloads) AS total_downloads
FROM base
GROUP BY
1,
2
)
SELECT
*
FROM aggregated
Name | Type | Comment |
---|
This SQL query aggregates download data for Apple Store apps. It starts by selecting all columns from a staging table, then groups the data by date, app ID, and source type. It calculates the sum of first-time downloads, redownloads, and total downloads for each group. The result is a summarized view of download statistics for each app, broken down by date and source type.
AggregationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__downloads_device
), aggregated AS (
SELECT
date_day,
app_id,
source_type,
SUM(first_time_downloads) AS first_time_downloads,
SUM(redownloads) AS redownloads,
SUM(total_downloads) AS total_downloads
FROM base
GROUP BY
1,
2,
3
)
SELECT
*
FROM aggregated
Name | Type | Comment |
---|
This SQL query retrieves crash data from a staging table, aggregates the number of crashes by date, app ID, and platform version, and adds a null source_type column. It performs a simple aggregation without any complex filtering, cleaning, or integration operations.
AggregationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__crashes_platform_version
), aggregated AS (
SELECT
date_day,
app_id,
platform_version,
CAST(NULL AS TEXT) AS source_type,
SUM(crashes) AS crashes
FROM base
GROUP BY
1,
2,
3,
4
)
SELECT
*
FROM aggregated
Name | Type | Comment |
---|
This SQL query aggregates data from the 'stg_apple_store__usage_device' table, summing up active devices, deletions, installations, and sessions for each unique combination of date and app ID. It provides a daily usage overview for each app in the Apple Store.
AggregationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_device
), aggregated AS (
SELECT
date_day,
app_id,
SUM(active_devices) AS active_devices,
SUM(deletions) AS deletions,
SUM(installations) AS installations,
SUM(sessions) AS sessions
FROM base
GROUP BY
1,
2
)
SELECT
*
FROM aggregated
Name | Type | Comment |
---|
This SQL query retrieves data from a staging table (stg_apple_store__usage_device) and aggregates it by date, app ID, and source type. It calculates the sum of active devices, deletions, installations, and sessions for each unique combination of these grouping fields.
AggregationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_device
), aggregated AS (
SELECT
date_day,
app_id,
source_type,
SUM(active_devices) AS active_devices,
SUM(deletions) AS deletions,
SUM(installations) AS installations,
SUM(sessions) AS sessions
FROM base
GROUP BY
1,
2,
3
)
SELECT
*
FROM aggregated
Name | Type | Comment |
---|
This SQL query performs a simple transformation on the 'stg_apple_store__app_tmp' table. It selects three specific columns (id, name, and is_enabled) from the source table, renames 'id' to 'app_id' and 'name' to 'app_name', and includes these along with 'is_enabled' in the final output. The query also defines a number of additional fields with NULL or default values, but these are not used in the final selection.
CleaningWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS app_opt_in_rate,
CAST(NULL AS TEXT) AS asset_token,
CAST(NULL AS TEXT) AS icon_url,
CAST(NULL AS INT) AS id,
CAST(NULL AS BOOLEAN) AS ios,
CAST(NULL AS BOOLEAN) AS is_bundle,
CAST(NULL AS BOOLEAN) AS is_enabled,
CAST(NULL AS TEXT) AS name,
CAST(NULL AS TEXT) AS pre_order_info,
CAST(NULL AS BOOLEAN) AS tvos
FROM base
), final AS (
SELECT
id AS app_id,
name AS app_name,
is_enabled
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
app_id | integer | Application ID. |
app_name | text | Application Name. |
is_enabled | boolean | Boolean indicator for whether application is enabled or not. |
This SQL query performs a series of transformations on data from the 'stg_apple_store__app_store_device_tmp' table. It first creates a CTE with all columns from the source table, then defines a structure for the fields with specific data types. Finally, it selects and casts certain columns, including converting the 'date' column to a DATE type and renaming it to 'date_day'. The query primarily focuses on data type casting and column selection/renaming.
CleaningWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app_store_device_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS TEXT) AS device,
CAST(NULL AS INT) AS impressions,
CAST(NULL AS INT) AS impressions_unique_device,
CAST(NULL AS BOOLEAN) AS meets_threshold,
CAST(NULL AS INT) AS page_views,
CAST(NULL AS INT) AS page_views_unique_device,
CAST(NULL AS TEXT) AS source_type
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
source_type,
device,
impressions,
impressions_unique_device,
page_views,
page_views_unique_device
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
device | text | Device type associated with the respective metric(s). |
impressions | integer | The number of times your app was viewed in the App Store for more than one second. This includes search results, Featured, Explore, Top Charts and App Product Page views. (Source: [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
impressions_unique_device | integer | The number of unique devices that have viewed your app for more than one second on on the Today, Games, Apps, Featured, Explore, Top Charts, Search tabs of the App Store and App Product Page views. This metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
page_views | integer | The total number of times your App Store product page was clicked and viewed; when a user taps on a link from an app, website or App Clip card that brings them to your App Store product page, the immediate product page_view is attributed to the referring app, website, or App Clip. (Sources: [Apple](https://help.apple.com/app-store-connect/#/itcf19c873df), [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
page_views_unique_device | integer | The number of unique devices that have viewed your App Store product page; this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
This SQL query selects all columns from the table 'TEST.itunes_connect.app_store_source_type_device_report' without any modifications or filtering. It appears to be a simple data extraction query, likely used as a staging step to copy all data from the source table into a new model or temporary table.
OtherSELECT
*
FROM TEST.itunes_connect.app_store_source_type_device_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
date | timestamp without time zone | None |
device | text | None |
source_type | text | None |
meets_threshold | boolean | None |
impressions | integer | None |
_fivetran_synced | timestamp without time zone | None |
impressions_unique_device | integer | None |
page_views | integer | None |
page_views_unique_device | integer | None |
This SQL query performs data type casting and column selection on the 'stg_apple_store__app_store_platform_version' table. It first creates a CTE with null values for all columns, then selects and renames specific columns from this CTE, casting the 'date' column to DATE type. The query focuses on preparing and structuring the data for further analysis, particularly related to app store metrics such as impressions and page views.
CleaningFeaturizationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app_store_platform_version_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS INT) AS impressions,
CAST(NULL AS INT) AS impressions_unique_device,
CAST(NULL AS BOOLEAN) AS meets_threshold,
CAST(NULL AS INT) AS page_views,
CAST(NULL AS INT) AS page_views_unique_device,
CAST(NULL AS TEXT) AS platform_version,
CAST(NULL AS TEXT) AS source_type
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
source_type,
platform_version,
impressions,
impressions_unique_device,
page_views,
page_views_unique_device
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
platform_version | text | The platform version of the device engaging with your app. |
impressions | integer | The number of times your app was viewed in the App Store for more than one second. This includes search results, Featured, Explore, Top Charts and App Product Page views. (Source: [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
impressions_unique_device | integer | The number of unique devices that have viewed your app for more than one second on on the Today, Games, Apps, Featured, Explore, Top Charts, Search tabs of the App Store and App Product Page views. This metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
page_views | integer | The total number of times your App Store product page was clicked and viewed; when a user taps on a link from an app, website or App Clip card that brings them to your App Store product page, the immediate product page_view is attributed to the referring app, website, or App Clip. (Sources: [Apple](https://help.apple.com/app-store-connect/#/itcf19c873df), [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
page_views_unique_device | integer | The number of unique devices that have viewed your App Store product page; this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
This SQL query selects all columns from the table 'app_store_platform_version_source_type_report' in the 'itunes_connect' schema of the 'TEST' database. It appears to be a straightforward data extraction query without any filtering, transformation, or aggregation.
OtherSELECT
*
FROM TEST.itunes_connect.app_store_platform_version_source_type_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
date | timestamp without time zone | None |
platform_version | text | None |
source_type | text | None |
meets_threshold | boolean | None |
impressions | integer | None |
_fivetran_synced | timestamp without time zone | None |
impressions_unique_device | integer | None |
page_views | integer | None |
page_views_unique_device | integer | None |
This SQL query performs a series of transformations on data from the 'stg_apple_store__app_store_territory_tmp' table. It first defines a base CTE that selects all columns from the source table. Then, it creates a 'fields' CTE that explicitly casts columns to specific data types, including setting some fields to NULL. Finally, in the 'final' CTE, it selects and renames certain columns, casting the 'date' column to a DATE type. The query ends by selecting all columns from the 'final' CTE.
CleaningFeaturizationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__app_store_territory_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS INT) AS impressions,
CAST(NULL AS INT) AS impressions_unique_device,
CAST(NULL AS BOOLEAN) AS meets_threshold,
CAST(NULL AS INT) AS page_views,
CAST(NULL AS INT) AS page_views_unique_device,
CAST(NULL AS TEXT) AS source_type,
CAST(NULL AS TEXT) AS territory
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
source_type,
territory,
impressions,
impressions_unique_device,
page_views,
page_views_unique_device
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
territory | text | The territory (aka country) full name associated with the report's respective metric(s). |
impressions | integer | The number of times your app was viewed in the App Store for more than one second. This includes search results, Featured, Explore, Top Charts and App Product Page views. (Source: [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
impressions_unique_device | integer | The number of unique devices that have viewed your app for more than one second on on the Today, Games, Apps, Featured, Explore, Top Charts, Search tabs of the App Store and App Product Page views. This metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
page_views | integer | The total number of times your App Store product page was clicked and viewed; when a user taps on a link from an app, website or App Clip card that brings them to your App Store product page, the immediate product page_view is attributed to the referring app, website, or App Clip. (Sources: [Apple](https://help.apple.com/app-store-connect/#/itcf19c873df), [BusinessofApps](https://www.businessofapps.com/insights/understanding-the-app-store-metrics/#:~:text=Impressions%20%E2%80%93%20%E2%80%9CThe%20number%20of%20times,was%20clicked%20on%20and%20viewed.)) |
page_views_unique_device | integer | The number of unique devices that have viewed your App Store product page; this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. |
This SQL query selects all columns from the 'app_store_territory_source_type_report' table in the 'itunes_connect' schema of the 'TEST' database. It appears to be a simple extraction of all data from the source table without any transformations or filtering.
OtherSELECT
*
FROM TEST.itunes_connect.app_store_territory_source_type_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
date | timestamp without time zone | None |
source_type | text | None |
territory | text | None |
meets_threshold | boolean | None |
impressions | integer | None |
_fivetran_synced | timestamp without time zone | None |
impressions_unique_device | integer | None |
page_views | integer | None |
page_views_unique_device | integer | None |
This SQL query selects all columns and rows from the 'app' table in the 'itunes_connect' schema of the 'TEST' database. It's a simple SELECT * statement without any filtering, transformation, or aggregation.
OtherSELECT
*
FROM TEST.itunes_connect.app
Name | Type | Comment |
---|---|---|
id | integer | None |
is_enabled | boolean | None |
name | text | None |
asset_token | text | None |
pre_order_info | integer | None |
icon_url | text | None |
app_opt_in_rate | integer | None |
ios | boolean | None |
tvos | boolean | None |
is_bundle | boolean | None |
_fivetran_synced | timestamp without time zone | None |
This SQL query performs a basic transformation on data from the 'stg_apple_store__crashes_app_version_tmp' table. It casts specific columns to defined data types, renames some columns, and selects a subset of columns for the final output. The main transformation is converting the 'date' column to a DATE type and renaming it to 'date_day'.
CleaningFeaturizationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__crashes_app_version_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS TEXT) AS app_version,
CAST(NULL AS INT) AS crashes,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS TEXT) AS device,
CAST(NULL AS BOOLEAN) AS meets_threshold
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
device,
app_version,
crashes
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
device | text | Device type associated with the respective metric(s). |
app_version | text | The app version of the app that the user is engaging with. |
crashes | integer | The number of recorded crashes experienced (User Opt-In only); a value of 0 indicates there were 0 crash reports or no value from the source report that day. |
This SQL query selects all columns from the 'crashes_app_version_device_report' table in the 'itunes_connect' schema of the 'TEST' database. It appears to be a straightforward data extraction query without any filtering, transformation, or aggregation.
OtherSELECT
*
FROM TEST.itunes_connect.crashes_app_version_device_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
app_version | text | None |
date | timestamp without time zone | None |
device | text | None |
meets_threshold | boolean | None |
crashes | integer | None |
_fivetran_synced | timestamp without time zone | None |
This SQL query performs a basic transformation on data from a staging table. It casts the 'date' column to a DATE type, renames it to 'date_day', and selects specific columns (date_day, app_id, device, platform_version, crashes) for the final output. The query also includes a CTE that defines data types for various fields, although these are not directly used in the final selection.
CleaningWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__crashes_platform_version_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS INT) AS crashes,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS TEXT) AS device,
CAST(NULL AS BOOLEAN) AS meets_threshold,
CAST(NULL AS TEXT) AS platform_version
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
device,
platform_version,
crashes
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
device | text | Device type associated with the respective metric(s). |
platform_version | text | The app version of the app that the user is engaging with. |
crashes | integer | The number of recorded crashes experienced (User Opt-In only); a value of 0 indicates there were 0 crash reports or no value from the source report that day. |
This SQL query selects all columns from the 'crashes_platform_version_device_report' table in the 'itunes_connect' schema of the 'TEST' database. It appears to be a straightforward data extraction without any transformations or filtering.
OtherSELECT
*
FROM TEST.itunes_connect.crashes_platform_version_device_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
date | timestamp without time zone | None |
device | text | None |
platform_version | text | None |
meets_threshold | boolean | None |
crashes | integer | None |
_fivetran_synced | timestamp without time zone | None |
This SQL query performs data type casting and column selection on the 'stg_apple_store__downloads_device_tmp' table. It casts the 'date' column to DATE type and selects specific columns for the final output. The query doesn't perform any filtering, deduplication, or aggregation operations.
CleaningWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__downloads_device_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS TEXT) AS device,
CAST(NULL AS INT) AS first_time_downloads,
CAST(NULL AS BOOLEAN) AS meets_threshold,
CAST(NULL AS INT) AS redownloads,
CAST(NULL AS TEXT) AS source_type,
CAST(NULL AS INT) AS total_downloads
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
source_type,
device,
first_time_downloads,
redownloads,
total_downloads
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
device | text | Device type associated with the respective metric(s). |
first_time_downloads | integer | The number of first time downloads for your app; credit is attributed to the referring app, website, or App Clip of the first time download. |
redownloads | integer | The count of redownloads where a redownload occurs when a user who previously downloaded your app adds it to their device again (User Opt-In only); credit is attributed to the source recorded when a user tapped to download/launch your app for the first time. A value of 0 indicates there were 0 redownloads or no value from the source report that day. |
total_downloads | integer | Total Downloads is the sum of Redownloads and First Time Downloads. |
This SQL query selects all columns from the 'downloads_source_type_device_report' table in the 'TEST.itunes_connect' schema. It appears to be a straightforward data extraction query without any filtering, transformation, or aggregation.
OtherSELECT
*
FROM TEST.itunes_connect.downloads_source_type_device_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
date | timestamp without time zone | None |
device | text | None |
source_type | text | None |
meets_threshold | boolean | None |
first_time_downloads | integer | None |
_fivetran_synced | timestamp without time zone | None |
redownloads | integer | None |
total_downloads | integer | None |
This SQL query performs data type casting and column selection on the 'stg_apple_store__downloads_platform_version' table. It casts the 'date' column to DATE type and selects specific columns for the final output. The query doesn't perform any filtering, deduplication, featurization, integration, or aggregation.
CleaningWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__downloads_platform_version_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS INT) AS first_time_downloads,
CAST(NULL AS BOOLEAN) AS meets_threshold,
CAST(NULL AS TEXT) AS platform_version,
CAST(NULL AS INT) AS redownloads,
CAST(NULL AS TEXT) AS source_type,
CAST(NULL AS INT) AS total_downloads
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
source_type,
platform_version,
first_time_downloads,
redownloads,
total_downloads
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
platform_version | text | The platform version of the device engaging with your app. |
first_time_downloads | integer | The number of first time downloads for your app; credit is attributed to the referring app, website, or App Clip of the first time download. |
redownloads | integer | The count of redownloads where a redownload occurs when a user who previously downloaded your app adds it to their device again (User Opt-In only); credit is attributed to the source recorded when a user tapped to download/launch your app for the first time. A value of 0 indicates there were 0 redownloads or no value from the source report that day. |
total_downloads | integer | Total Downloads is the sum of Redownloads and First Time Downloads. |
This SQL query selects all columns from the 'downloads_platform_version_source_type_report' table in the 'itunes_connect' schema of the 'TEST' database. It appears to be a simple extraction of raw data without any transformations or filters.
OtherSELECT
*
FROM TEST.itunes_connect.downloads_platform_version_source_type_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
date | timestamp without time zone | None |
platform_version | text | None |
source_type | text | None |
meets_threshold | boolean | None |
first_time_downloads | integer | None |
_fivetran_synced | timestamp without time zone | None |
redownloads | integer | None |
total_downloads | integer | None |
This SQL query performs data type casting and column selection on the apple_store_source.stg_apple_store__downloads_territory_tmp table. It casts the 'date' column to DATE type and selects specific columns for the final output. The query doesn't perform any filtering, deduplication, featurization, integration, or aggregation.
CleaningWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__downloads_territory_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS INT) AS first_time_downloads,
CAST(NULL AS BOOLEAN) AS meets_threshold,
CAST(NULL AS INT) AS redownloads,
CAST(NULL AS TEXT) AS source_type,
CAST(NULL AS TEXT) AS territory,
CAST(NULL AS INT) AS total_downloads
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
source_type,
territory,
first_time_downloads,
redownloads,
total_downloads
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
territory | text | The territory (aka country) full name associated with the report's respective metric(s). |
first_time_downloads | integer | The number of first time downloads for your app; credit is attributed to the referring app, website, or App Clip of the first time download. |
redownloads | integer | The count of redownloads where a redownload occurs when a user who previously downloaded your app adds it to their device again (User Opt-In only); credit is attributed to the source recorded when a user tapped to download/launch your app for the first time. A value of 0 indicates there were 0 redownloads or no value from the source report that day. |
total_downloads | integer | Total Downloads is the sum of Redownloads and First Time Downloads. |
This SQL query selects all columns from the 'downloads_territory_source_type_report' table in the 'itunes_connect' schema of the 'TEST' database. It appears to be a straightforward data extraction without any transformations or filtering.
OtherSELECT
*
FROM TEST.itunes_connect.downloads_territory_source_type_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
date | timestamp without time zone | None |
source_type | text | None |
territory | text | None |
meets_threshold | boolean | None |
first_time_downloads | integer | None |
_fivetran_synced | timestamp without time zone | None |
redownloads | integer | None |
total_downloads | integer | None |
This SQL query performs a basic transformation on data from the 'stg_apple_store__sales_account_tmp' table. It selects all columns from the base table, then defines a set of fields with specific data types (although all values are set to NULL in this case). Finally, it renames two columns: 'id' to 'account_id' and 'name' to 'account_name'. The query doesn't perform any filtering, cleaning, deduplication, featurization, integration, or aggregation.
OtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__sales_account_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS id,
CAST(NULL AS TEXT) AS name
FROM base
), final AS (
SELECT
id AS account_id,
name AS account_name
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
account_id | integer | Sales Account ID associated with the app name or app ID. |
account_name | text | Sales Account Name associated with the Sales Account ID, app name or app ID. |
This SQL query selects all columns and rows from the 'sales_account' table in the 'itunes_connect' schema of the 'TEST' database. It appears to be a simple data extraction query without any filtering, transformation, or aggregation.
OtherSELECT
*
FROM TEST.itunes_connect.sales_account
Name | Type | Comment |
---|---|---|
id | integer | None |
name | text | None |
_fivetran_synced | timestamp without time zone | None |
This SQL query performs data transformation and type casting on the 'stg_apple_store__usage_app_version_tmp' table. It creates a CTE structure to first select all columns from the source table, then defines and casts specific fields to appropriate data types. Finally, it selects and renames certain columns, including converting the 'date' field to a DATE type. The query primarily focuses on data cleaning and formatting.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_app_version_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS active_devices,
CAST(NULL AS INT) AS active_devices_last_30_days,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS TEXT) AS app_version,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS INT) AS deletions,
CAST(NULL AS INT) AS installations,
CAST(NULL AS BOOLEAN) AS meets_threshold,
CAST(NULL AS INT) AS sessions,
CAST(NULL AS TEXT) AS source_type
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
source_type,
app_version,
active_devices,
active_devices_last_30_days,
deletions,
installations,
sessions
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
app_version | text | The app version of the app that the user is engaging with. |
active_devices | integer | The count of active_device is the count of devices that ran the app at least one time and for at least two seconds on a given day (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices or no value from the source report that day. |
active_devices_last_30_days | integer | The count of active_devices_last_30_days is the count of devices that ran the app at least one time and for at least two seconds on the date_day of the report minus 30 days (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices last 30 days or no value from the source report that day. |
deletions | integer | A deletion occurs when a user removes your app from their device (User Opt-In only). Data from resetting or erasing a device’s content and settings is not included. A value of 0 indicates there were 0 deletions or no value from the source report that day. |
installations | integer | An installation event is when the user opens the App after they've downloaded it (User Opt-In only). If the App was downloaded but not opened or opened offline, this will not count; if the user opts out of sending data back to Apple, there will also be no data here. A value of 0 indicates there were 0 installations or no value from the source report that day. |
sessions | integer | Sessions is the count of the number of times the app has been used for at least two seconds (User Opt-In only). If the app is in the background and is later used again, that counts as another session. A value of 0 indicates there were 0 sessions or no value from the source report that day. |
This SQL query selects all columns from the 'usage_app_version_source_type_report' table in the 'itunes_connect' schema of the 'TEST' database. It appears to be a simple data extraction query without any transformation, filtering, or aggregation.
OtherSELECT
*
FROM TEST.itunes_connect.usage_app_version_source_type_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
app_version | text | None |
date | timestamp without time zone | None |
source_type | text | None |
meets_threshold | boolean | None |
installations | integer | None |
_fivetran_synced | timestamp without time zone | None |
sessions | integer | None |
active_devices | integer | None |
active_devices_last_30_days | integer | None |
deletions | integer | None |
This SQL query performs type casting and column selection on data from the 'stg_apple_store__usage_device_tmp' table. It casts various columns to specific data types, renames some columns, and selects a subset of columns for the final output. The query also converts the 'date' column to a DATE type and renames it to 'date_day'.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_device_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS active_devices,
CAST(NULL AS INT) AS active_devices_last_30_days,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS INT) AS deletions,
CAST(NULL AS TEXT) AS device,
CAST(NULL AS INT) AS installations,
CAST(NULL AS BOOLEAN) AS meets_threshold,
CAST(NULL AS INT) AS sessions,
CAST(NULL AS TEXT) AS source_type
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
source_type,
device,
active_devices,
active_devices_last_30_days,
deletions,
installations,
sessions
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
device | text | Device type associated with the respective metric(s). |
active_devices | integer | The count of active_device is the count of devices that ran the app at least one time and for at least two seconds on a given day (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices or no value from the source report that day. |
active_devices_last_30_days | integer | The count of active_devices_last_30_days is the count of devices that ran the app at least one time and for at least two seconds on the date_day of the report minus 30 days (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices last 30 days or no value from the source report that day. |
deletions | integer | A deletion occurs when a user removes your app from their device (User Opt-In only). Data from resetting or erasing a device’s content and settings is not included. A value of 0 indicates there were 0 deletions or no value from the source report that day. |
installations | integer | An installation event is when the user opens the App after they've downloaded it (User Opt-In only). If the App was downloaded but not opened or opened offline, this will not count; if the user opts out of sending data back to Apple, there will also be no data here. A value of 0 indicates there were 0 installations or no value from the source report that day. |
sessions | integer | Sessions is the count of the number of times the app has been used for at least two seconds (User Opt-In only). If the app is in the background and is later used again, that counts as another session. A value of 0 indicates there were 0 sessions or no value from the source report that day. |
This SQL query selects all columns from the 'usage_source_type_device_report' table in the 'itunes_connect' schema of the 'TEST' database. It appears to be a simple data extraction query without any filtering, transformation, or aggregation.
OtherSELECT
*
FROM TEST.itunes_connect.usage_source_type_device_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
date | timestamp without time zone | None |
device | text | None |
source_type | text | None |
meets_threshold | boolean | None |
installations | integer | None |
_fivetran_synced | timestamp without time zone | None |
sessions | integer | None |
active_devices | integer | None |
active_devices_last_30_days | integer | None |
deletions | integer | None |
This SQL query performs data transformation and type casting on the 'stg_apple_store__usage_platform_version' table. It starts by selecting all columns from a temporary table, then defines a set of fields with specific data types. Finally, it selects and renames certain columns, casting the 'date' column to a DATE type. The query primarily focuses on data cleaning and restructuring.
CleaningFeaturizationWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_platform_version_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS active_devices,
CAST(NULL AS INT) AS active_devices_last_30_days,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS INT) AS deletions,
CAST(NULL AS INT) AS installations,
CAST(NULL AS BOOLEAN) AS meets_threshold,
CAST(NULL AS TEXT) AS platform_version,
CAST(NULL AS INT) AS sessions,
CAST(NULL AS TEXT) AS source_type
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
source_type,
platform_version,
active_devices,
active_devices_last_30_days,
deletions,
installations,
sessions
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
platform_version | text | The platform version of the device engaging with your app. |
active_devices | integer | The count of active_device is the count of devices that ran the app at least one time and for at least two seconds on a given day (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices or no value from the source report that day. |
active_devices_last_30_days | integer | The count of active_devices_last_30_days is the count of devices that ran the app at least one time and for at least two seconds on the date_day of the report minus 30 days (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices last 30 days or no value from the source report that day. |
deletions | integer | A deletion occurs when a user removes your app from their device (User Opt-In only). Data from resetting or erasing a device’s content and settings is not included. A value of 0 indicates there were 0 deletions or no value from the source report that day. |
installations | integer | An installation event is when the user opens the App after they've downloaded it (User Opt-In only). If the App was downloaded but not opened or opened offline, this will not count; if the user opts out of sending data back to Apple, there will also be no data here. A value of 0 indicates there were 0 installations or no value from the source report that day. |
sessions | integer | Sessions is the count of the number of times the app has been used for at least two seconds (User Opt-In only). If the app is in the background and is later used again, that counts as another session. A value of 0 indicates there were 0 sessions or no value from the source report that day. |
This SQL query selects all columns from the 'usage_platform_version_source_type_report' table in the 'itunes_connect' schema of the 'TEST' database. It appears to be a simple data extraction query without any transformations or filters.
OtherSELECT
*
FROM TEST.itunes_connect.usage_platform_version_source_type_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
date | timestamp without time zone | None |
platform_version | text | None |
source_type | text | None |
meets_threshold | boolean | None |
installations | integer | None |
_fivetran_synced | timestamp without time zone | None |
sessions | integer | None |
active_devices | integer | None |
active_devices_last_30_days | integer | None |
deletions | integer | None |
This SQL query performs data type casting and column selection on the 'stg_apple_store__usage_territory_tmp' table. It first creates a CTE with all columns from the source table, then defines the data types for each column in a second CTE. Finally, it selects and renames specific columns, casting the 'date' column to DATE type. The query focuses on preparing and structuring the data for further use.
CleaningOtherWITH base AS (
SELECT
*
FROM TEST.PUBLIC_apple_store_source.stg_apple_store__usage_territory_tmp
), fields AS (
SELECT
CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
CAST(NULL AS INT) AS active_devices,
CAST(NULL AS INT) AS active_devices_last_30_days,
CAST(NULL AS INT) AS app_id,
CAST(NULL AS TIMESTAMP) AS date,
CAST(NULL AS INT) AS deletions,
CAST(NULL AS INT) AS installations,
CAST(NULL AS BOOLEAN) AS meets_threshold,
CAST(NULL AS INT) AS sessions,
CAST(NULL AS TEXT) AS source_type,
CAST(NULL AS TEXT) AS territory
FROM base
), final AS (
SELECT
CAST(date AS DATE) AS date_day,
app_id,
source_type,
territory,
active_devices,
active_devices_last_30_days,
deletions,
installations,
sessions
FROM fields
)
SELECT
*
FROM final
Name | Type | Comment |
---|---|---|
date_day | date | The date of the report and respective recorded metric(s); follows the format `YYYY-MM-DD`. |
app_id | integer | Application ID. |
source_type | text | A source is counted when a customer follows a link to your App Store product page. There are 8 types of sources: App Store Browse, App Store Search, App Referrers, Web Referrers, App Clips, Unavailable, Institutional Purchases, and Null. Null is the default value for data that does not provide source types, including: crashes, subscription events and subscription summary. More information can be found in the Apple App Store developer [docs](https://developer.apple.com/help/app-store-connect/view-app-analytics/view-acquisition-sources/). |
territory | text | The territory (aka country) full name associated with the report's respective metric(s). |
active_devices | integer | The count of active_device is the count of devices that ran the app at least one time and for at least two seconds on a given day (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices or no value from the source report that day. |
active_devices_last_30_days | integer | The count of active_devices_last_30_days is the count of devices that ran the app at least one time and for at least two seconds on the date_day of the report minus 30 days (User Opt-In only); this metric is presumed to be de-duplicated daily as received from the source data, therefore, aggregating over a span of days is better done in the UI. A value of 0 indicates there were 0 active devices last 30 days or no value from the source report that day. |
deletions | integer | A deletion occurs when a user removes your app from their device (User Opt-In only). Data from resetting or erasing a device’s content and settings is not included. A value of 0 indicates there were 0 deletions or no value from the source report that day. |
installations | integer | An installation event is when the user opens the App after they've downloaded it (User Opt-In only). If the App was downloaded but not opened or opened offline, this will not count; if the user opts out of sending data back to Apple, there will also be no data here. A value of 0 indicates there were 0 installations or no value from the source report that day. |
sessions | integer | Sessions is the count of the number of times the app has been used for at least two seconds (User Opt-In only). If the app is in the background and is later used again, that counts as another session. A value of 0 indicates there were 0 sessions or no value from the source report that day. |
This SQL query selects all columns from the 'usage_territory_source_type_report' table in the 'itunes_connect' schema of the 'TEST' database. It appears to be a simple data extraction query without any transformations or filters.
OtherSELECT
*
FROM TEST.itunes_connect.usage_territory_source_type_report
Name | Type | Comment |
---|---|---|
app_id | integer | None |
date | timestamp without time zone | None |
source_type | text | None |
territory | text | None |
meets_threshold | boolean | None |
installations | integer | None |
_fivetran_synced | timestamp without time zone | None |
sessions | integer | None |
active_devices | integer | None |
active_devices_last_30_days | integer | None |
deletions | integer | None |