GCP Big Query Notes

From Federal Burro of Information
Revision as of 13:56, 11 August 2020 by David (talk | contribs) (Created page with " query on labels: https://cloud.google.com/billing/docs/how-to/bq-examples <pre> SELECT labels.value as environment, SUM(cost) as cost FROM `project.dataset.gcp_billing...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

query on labels:

https://cloud.google.com/billing/docs/how-to/bq-examples

SELECT
  labels.value as environment,
  SUM(cost) as cost
FROM `project.dataset.gcp_billing_export_v1_XXXXXX_XXXXXX_XXXXXX`
LEFT JOIN UNNEST(labels) as labels
  ON labels.key = "environment"
GROUP BY environment;