Revert "Simplify GLAM template for getting latest versions (#3880)" (#3908)

This reverts commit 8ad45a0592.
This commit is contained in:
Linh Nguyen 2023-06-06 14:41:03 -04:00 коммит произвёл GitHub
Родитель e2cc3d1d31
Коммит d6a55664d0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 37 добавлений и 19 удалений

Просмотреть файл

@ -28,16 +28,6 @@ class TemplateResult:
query_text: str
APP_PREFIX_CHANNELS = {
"firefox_desktop_glam_nightly": "nightly",
"firefox_desktop_glam_beta": "beta",
"firefox_desktop_glam_release": "release",
"org_mozilla_fenix_glam_nightly": "nightly",
"org_mozilla_fenix_glam_beta": "beta",
"org_mozilla_fenix_glam_release": "release",
}
def from_template(
query_type: QueryType,
template_name: str,
@ -223,7 +213,11 @@ def main():
[
table(
"latest_versions_v1",
**dict(app_id_channel=(f"'{APP_PREFIX_CHANNELS[args.prefix]}'")),
**dict(
source_table=(
f"glam_etl.{args.prefix}__view_clients_daily_scalar_aggregates_v1"
)
),
),
init(
"clients_scalar_aggregates_v1",

Просмотреть файл

@ -1,12 +1,36 @@
{{ header }}
WITH extracted AS (
SELECT
client_id,
channel,
app_version
FROM
{{ source_table }}
WHERE
submission_date
BETWEEN DATE_SUB(@submission_date, INTERVAL 28 DAY)
AND @submission_date
AND channel IS NOT NULL
),
transformed AS (
SELECT
channel,
app_version
FROM
extracted
GROUP BY
channel,
app_version
HAVING
COUNT(DISTINCT client_id) > 5
ORDER BY
channel,
app_version DESC
)
SELECT
build.`target`.channel AS channel,
MAX(mozfun.norm.extract_version(build.`target`.version,
'major')) AS latest_version
channel,
MAX(app_version) AS latest_version
FROM
`moz-fx-data-shared-prod.telemetry.buildhub2`
WHERE
build.`source`.product = "firefox"
AND build.`target`.channel = {{ app_id_channel }}
transformed
GROUP BY
build.`target`.channel
channel