Skip to content

Commit aa5515c

Browse files
committed
feat: revert firefox_app_store_territory_source_type_report
1 parent f163fd0 commit aa5515c

File tree

1 file changed

+5
-39
lines changed
  • sql/moz-fx-data-shared-prod/app_store/firefox_app_store_territory_source_type_report

1 file changed

+5
-39
lines changed
Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,11 @@
11
CREATE OR REPLACE VIEW
22
`moz-fx-data-shared-prod.app_store.firefox_app_store_territory_source_type_report`
33
AS
4-
-- https://developer.apple.com/help/app-store-connect/view-sales-and-trends/download-and-view-reports
5-
-- "Time zone: Reports are based on Pacific Time (PT). A day includes transactions that happened from 12:00 a.m. to 11:59 p.m. PT.
64
SELECT
7-
-- However, this timestamp appear to always show midnight meaning if we do timezone conversion
8-
-- we will end up moving all results 1 day back if we attempt conversion to UTC.
9-
DATE(`date`) AS `date`,
10-
app_id,
11-
CAST(NULL AS STRING) AS app_name,
12-
source_type,
13-
territory,
14-
impressions,
15-
impressions_unique_device,
16-
page_views,
17-
page_views_unique_device,
18-
-- These fields did not exist in the previous version.
19-
CAST(NULL AS INTEGER) AS first_time_downloads,
20-
CAST(NULL AS INTEGER) AS redownloads,
21-
CAST(NULL AS INTEGER) AS total_downloads,
5+
-- https://developer.apple.com/help/app-store-connect/view-sales-and-trends/download-and-view-reports
6+
-- "Time zone: Reports are based on Pacific Time (PT). A day includes transactions that happened from 12:00 a.m. to 11:59 p.m. PT."
7+
-- Date conversion in the query is required to unify the dates to UTC timezone which is what we use.
8+
* REPLACE (TIMESTAMP(DATETIME(`date`, "America/Los_Angeles")) AS `date`),
9+
`date` AS date_pst,
2210
FROM
2311
`moz-fx-data-shared-prod.app_store_syndicate.app_store_territory_source_type_report`
24-
WHERE
25-
`date` < "2024-01-01"
26-
UNION ALL
27-
-- New connector's data. The schema is a bit different and the new one includes additional metrics:
28-
-- first_time_downloads, redownloads, and total_downloads.
29-
SELECT
30-
date_day AS `date`,
31-
app_id,
32-
app_name,
33-
source_type,
34-
territory_long AS territory,
35-
impressions,
36-
impressions_unique_device,
37-
page_views,
38-
page_views_unique_device,
39-
first_time_downloads,
40-
redownloads,
41-
total_downloads,
42-
FROM
43-
`moz-fx-data-bq-fivetran.firefox_app_store_v2_apple_store.apple_store__territory_report`
44-
WHERE
45-
date_day >= "2024-01-01"

0 commit comments

Comments
 (0)