Query logic of the test (BigQuery data)
Note:
BigQuery authentication is only available to users with premium access. If you want to know more,
contact us
.
Structure of the BigQuery Query logic
The Query logic for BigQuery data is in the form of SQL script, same as in the BigQuery Studio. The only difference is that you only refer to tables as [dataset].[table] (without specifying the project) because you already specified the BigQuery project when creating theset of tests. For details on how to write the query refer to the official documentation.
Note:
When using prepared templates in Waaila you always have to adjust the dataset name and table name as they are not customized based on your project choice.
Waaila tip:
To query data for a relative date (e.g. yesterday) you can use the filter on _TABLE_SUFFIX in combination with timestamp functions (see example below).
DECLARE yesterday_date STRING DEFAULT FORMAT_TIMESTAMP('%Y%m%d', TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY));
SELECT
device.category, COUNT(*) AS pageviews
FROM
`analytics_987654321.events_*`
WHERE
event_name = 'page_view' AND _TABLE_SUFFIX = yesterday_date
GROUP BY
device.category