GCP Big Query Notes

From Federal Burro of Information
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;