We are using labels on GCP projects, and I am trying to figure out how to "unwrap" them/ query against them. I am finding almost no success as any search with BigQuery and labels returns results related to label in BQ itself.
I have tried several selects, but can't crack it.
SELECT
name,
#JSON_QUERY(TO_JSON(prj.resource.data.labels),"$"),
# ARRAY_TO_STRING(prj.resource.data.labels, ','),
#TO_JSON_STRING(prj.resource.data.labels),
prj.resource.data.labels,
FROM
cloudresourcemanager_googleapis_com_Project AS prj
#WHERE
# prj.resource.data.labels.key = 'vanity-name' AND
# prj.resource.data.labels.value = 'bob'
;
The above query shows the following data structure:
Can anyone give guidance on how to:
- Query into the labels to say "does key 'x' exist", and/or "does key 'x' exist and is it's value 'y'"?
Thanks in advance for any help....