in glam/api/views.py [0:0]
def _get_random_probes(data_source, random_percentage, limit):
# Get a random list of `limit` probes from the Desktop nightly table.
query_template = """
SELECT {} metric, histogram
FROM {}
WHERE
build_id='*'
AND os='*'
AND metric_key=''
AND metric_type NOT IN ('boolean', 'histogram-boolean', 'scalar')
AND {} < {}
LIMIT {}
"""
if data_source == "BigQuery":
table_name = (
f"`{GLAM_BQ_PROD_PROJECT}.glam_etl.glam_desktop_nightly_aggregates`"
)
with bigquery.Client() as client:
aggs = client.query(
query_template.format(
"", table_name, "RAND()", random_percentage, limit
)
)
else:
table_name = "view_glam_desktop_nightly_aggregation"
aggs = DesktopNightlyAggregationView.objects.raw(
query_template.format(
"id,", table_name, "RANDOM()", random_percentage, limit
)
)
return aggs