bigquery-etl/sql_generators/glean_usage/baseline_clients_first_seen.py

42 строки
1.3 KiB
Python
Исходник Обычный вид История

"""Generate and run baseline_clients_first_seen queries for Glean apps."""
2021-12-16 00:49:53 +03:00
from sql_generators.glean_usage.common import GleanTable
TARGET_TABLE_ID = "baseline_clients_first_seen_v1"
PREFIX = "first_seen"
2021-05-13 02:23:05 +03:00
class BaselineClientsFirstSeenTable(GleanTable):
2021-05-13 22:40:52 +03:00
"""Represents generated baseline_clients_first_seen table."""
2021-05-13 02:23:05 +03:00
def __init__(self):
2021-05-13 22:40:52 +03:00
"""Initialize baseline_clients_first_seen table."""
2021-05-14 00:32:13 +03:00
GleanTable.__init__(self)
2021-05-13 02:23:05 +03:00
self.target_table_id = TARGET_TABLE_ID
self.prefix = PREFIX
self.no_init = False
self.custom_render_kwargs = {}
2021-05-13 19:40:42 +03:00
def generate_per_app_id(self, project_id, baseline_table, output_dir=None):
2021-05-13 22:40:52 +03:00
"""Generate per-app_id datasets."""
2021-05-13 02:23:05 +03:00
self.custom_render_kwargs = dict(
# do not match on org_mozilla_firefoxreality
fennec_id=any(
(f"{app_id}_stable" in baseline_table)
for app_id in [
"org_mozilla_firefox",
"org_mozilla_fenix_nightly",
"org_mozilla_fennec_aurora",
"org_mozilla_firefox_beta",
"org_mozilla_fenix",
]
)
)
GleanTable.generate_per_app_id(
self,
project_id,
baseline_table,
output_dir=output_dir,
)